Getting Error 80070006
when try running wsus.vbs script, says line:61 char:1 handle invalid. code:80070006. can it?
the script follows:-
set updatesession = createobject("microsoft.update.session")
set updatesearcher = updatesession.createupdatesearcher()
wscript.echo "searching updates..." & vbcrlf
set searchresult = _
updatesearcher.search("isinstalled=0 , type='software'")
wscript.echo "list of applicable items on machine:"
= 0 searchresult.updates.count-1
set update = searchresult.updates.item(i)
wscript.echo + 1 & "> " & update.title
next
if searchresult.updates.count = 0 then
wscript.echo "there no applicable updates."
wscript.quit
end if
wscript.echo vbcrlf & "creating collection of updates download:"
set updatestodownload = createobject("microsoft.update.updatecoll")
= 0 searchresult.updates.count-1
set update = searchresult.updates.item(i)
wscript.echo + 1 & "> adding: " & update.title
updatestodownload.add(update)
next
wscript.echo vbcrlf & "downloading updates..."
set downloader = updatesession.createupdatedownloader()
downloader.updates = updatestodownload
downloader.download()
wscript.echo vbcrlf & "list of downloaded updates:"
= 0 searchresult.updates.count-1
set update = searchresult.updates.item(i)
if update.isdownloaded then
wscript.echo + 1 & "> " & update.title
end if
next
set updatestoinstall = createobject("microsoft.update.updatecoll")
wscript.echo vbcrlf & _
"creating collection of downloaded updates install:"
= 0 searchresult.updates.count-1
set update = searchresult.updates.item(i)
if update.isdownloaded = true then
wscript.echo + 1 & "> adding: " & update.title
updatestoinstall.add(update)
end if
next
wscript.echo vbcrlf & "would install updates now? (y/n)"
strinput = wscript.stdin.readline ** line 61
wscript.echo
if (strinput = "n" or strinput = "n")
wscript.quit
elseif (strinput = "y" or strinput = "y") then
wscript.echo "installing updates..."
set installer = updatesession.createupdateinstaller()
installer.updates = updatestoinstall
set installationresult = installer.install()
'output results of install
wscript.echo "installation result: " & _
installationresult.resultcode
wscript.echo "reboot required: " & _
installationresult.rebootrequired & vbcrlf
wscript.echo "listing of updates installed " & _
"and individual installation results:"
= 0 updatestoinstall.count - 1
wscript.echo + 1 & "> " & _
updatestoinstall.item(i).title & _
": " & installationresult.getupdateresult(i).resultcode
next
end if
i got script from:-
http://msdn.microsoft.com/en-us/library/aa387102%28v=vs.85%29.aspx
yeah... unfortunately ... , despite vocal complaints ... , promises rectified ... wuagent api documentation has not been updated in eons.
as example of how "current" content might be, text found a few pages earlier in section determining current version of wua. while information still factually true, submit updated documentation five-year old product ought not concerned making distinction legacy product old. original text found in original relesae of wsus v2 api in 2005.
determine version of windows update agent (wua) before use it. current version of wua determined version of wuaueng.dll running in \system32 subdirectory of current windows installation. if version of wuaueng.dll version 5.4.3790.1000 or later version, wua installed. version earlier 5.4.3790.1000 indicates software update services (sus) 1.0 installed.so, can pretty assume starting point code targeted @ wsus v2 api, , may not work on wsus v3 api. you'll need research individual method calls , update code compatible.when call made sus 1.0 using wua api, hresult of wu_e_au_legacyserver returned.
lawrence garvin, m.s., mcitp:ea, mcdba, mcsa
principal/cto, onsite technology solutions, houston, texas
microsoft mvp - software distribution (2005-2010)
mvp profile: http://mvp.support.microsoft.com/profile/lawrence.garvin
blog: http://onsitechsolutions.spaces.live.com
Windows Server > WSUS
Comments
Post a Comment