Dutchict
asked on
Need VBscript to check available updates on update.microsoft.com
Need script to auto check update.microsoft.com and list available updates in a html file. Anyone can help?
ASKER
Hi Rob,
I just don't have the IQ to build a browse script to check the updates and put the feedback on my HTML output...
Can you help me?
I just don't have the IQ to build a browse script to check the updates and put the feedback on my HTML output...
Can you help me?
ASKER
Hi guys, i found this update check script, but i need to transform this into my already made html output script
I have replaced all (wscript.echo ") to (strHTML = strHTML & VbCrLf & "<br>)
Anyone suggestions????
I have replaced all (wscript.echo ") to (strHTML = strHTML & VbCrLf & "<br>)
Anyone suggestions????
Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
Set objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates
For i = 0 to colUpdates.Count - 1
Wscript.Echo "Title: " & colUpdates.Item(i).Title
Wscript.Echo "Autoselect on Web sites: " & colUpdates.Item(i).AutoSelectOnWebSites
For Each strUpdate in colUpdates.Item(i).BundledUpdates
Wscript.Echo "Bundled update: " & strUpdate
Next
Wscript.Echo "Can require source: " & colUpdates.Item(i).CanRequireSource
Set objCategories = colUpdates.Item(i).Categories
For z = 0 to objCategories.Count - 1
Wscript.Echo "Category name: " & objCategories.Item(z).Name
Wscript.Echo "Category ID: " & objCategories.Item(z).CategoryID
For Each strChild in objCategories.Item(z).Children
Wscript.Echo "Child category: " & strChild
Next
Wscript.Echo "Category description: " & objCategories.Item(z).Description
Wscript.Echo "Category type: " & objCategories.Item(z).Type
Next
Wscript.Echo "Deadline: " & colUpdates.Item(i).Deadline
Wscript.Echo "Delta compressed content available: " & _
colUpdates.Item(i).DeltaCompressedContentAvailable
Wscript.Echo "Delta compressed content preferred: " & _
colUpdates.Item(i).DeltaCompressedContentPreferred
Wscript.Echo "Description: " & colUpdates.Item(i).Description
Wscript.Echo "EULA accepted: " & colUpdates.Item(i).EULAAccepted
Wscript.Echo "EULA text: " & colUpdates.Item(i).EULAText
Wscript.Echo "Handler ID: " & colUpdates.Item(i).HandlerID
Set objIdentity = colUpdates.Item(i).Identity
Wscript.Echo "Revision number: " & objIdentity.RevisionNumber
Wscript.Echo "Update ID: " & objIdentity.UpdateID
Set objInstallationBehavior = colUpdates.Item(i).InstallationBehavior
Wscript.Echo "Can request user input: " & objInstallationBehavior.CanRequestUserInput
Select Case objInstallationBehavior.Impact
Case 0
Wscript.Echo "Installation impact: Typical"
Case 1
Wscript.Echo "Installation impact: Negligible"
Case 2
Wscript.Echo "Installation impact: High"
Case Else
Wscript.Echo "The installation impact could not be determined."
End Select
Select Case objInstallationBehavior.RebootBehavior
Case 0
Wscript.Echo "Reboot behavior: No reboot required after installation."
Case 1
Wscript.Echo "Reboot behavior: A reboot is required after installation."
Case 2
Wscript.Echo "Reboot behavior: A reboot might be required after installation."
Case Else
Wscript.Echo "Reboot behavior: No information available regarding the need for a reboot."
End Select
Wscript.Echo "Requires network connectivity: " & objInstallationBehavior.RequiresNetworkConnectivity
Wscript.Echo "Is beta: " & colUpdates.Item(i).IsBeta
Wscript.Echo "Is hidden: " & colUpdates.Item(i).IsHidden
Wscript.Echo "Is installed: " & colUpdates.Item(i).IsInstalled
Wscript.Echo "Is mandatory: " & colUpdates.Item(i).IsMandatory
Wscript.Echo "Is uninstallable: " & colUpdates.Item(i).IsUninstallable
For Each strLanguage in colUpdates.Item(i).Languages
Wscript.Echo "Supported language: " & strLanguage
Next
Wscript.Echo "Last deployment change time: " & colUpdates.Item(i).LastDeploymentChangeTime
Wscript.Echo "Maximum download size: " & colUpdates.Item(i).MaxDownloadSize
Wscript.Echo "Minimum download size: " & colUpdates.Item(i).MinDownloadSize
Wscript.Echo "Microsoft Security Response Center severity: " & colUpdates.Item(i).MsrcSeverity
Wscript.Echo "Support URL: " & colUpdates.Item(i).SupportURL
Select Case colUpdates.Item(i).Type
Case 1
Wscript.Echo "Update type: Software"
Case 2
Wscript.Echo "Update type: Driver"
Case Else
Wscript.Echo "Update type: The update type could not be determined."
End Select
Wscript.Echo "Uninstallation notes: " & colUpdates.Item(i).UninstallationNotes
x = 1
For Each strStep in colUpdates.Item(i).UninstallationSteps
Wscript.Echo x & " -- " & strStep
x = x + 1
Next
For Each strArticle in colUpdates.Item(i).KBArticleIDs
Wscript.Echo "KB article: " & strArticle
Next
Wscript.Echo
Next
ASKER
Atached is the latest code, don't know why, but i get a blanc page in return...
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objSearcher = CreateObject("Microsoft.Update.Searcher")
Set objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates
For i = 0 to colUpdates.Count - 1
strHTML = strHTML & VbCrLf & "<br>Title: " & colUpdates.Item(i).Title
strHTML = strHTML & VbCrLf & "<br>Autoselect on Web sites: " & _
colUpdates.Item(i).AutoSelectOnWebSites
For Each strUpdate in colUpdates.Item(i).BundledUpdates
strHTML = strHTML & VbCrLf & "<br>Bundled update: " & strUpdate
Next
strHTML = strHTML & VbCrLf & "<br>Can require source: " & colUpdates.Item(i).CanRequireSource
Set objCategories = colUpdates.Item(i).Categories
For z = 0 to objCategories.Count - 1
strHTML = strHTML & VbCrLf & "<br>Category name: " & objCategories.Item(z).Name
strHTML = strHTML & VbCrLf & "<br>Category ID: " & objCategories.Item(z).CategoryID
For Each strChild in objCategories.Item(z).Children
strHTML = strHTML & VbCrLf & "<br>Child category: " & strChild
Next
strHTML = strHTML & VbCrLf & "<br>Category description: " & _
objCategories.Item(z).Description
strHTML = strHTML & VbCrLf & "<br>Category order: " & objCategories.Item(z).Order
strHTML = strHTML & VbCrLf & "<br>Category type: " & objCategories.Item(z).Type
Next
strHTML = strHTML & VbCrLf & "<br>Deadline: " & colUpdates.Item(i).Deadline
strHTML = strHTML & VbCrLf & "<br>Delta compressed content available: " & _
colUpdates.Item(i).DeltaCompressedContentAvailable
strHTML = strHTML & VbCrLf & "<br>Delta compressed content preferred: " & _
colUpdates.Item(i).DeltaCompressedContentPreferred
strHTML = strHTML & VbCrLf & "<br>Description: " & colUpdates.Item(i).Description
strHTML = strHTML & VbCrLf & "<br>EULA accepted: " & colUpdates.Item(i).EULAAccepted
strHTML = strHTML & VbCrLf & "<br>EULA text: " & colUpdates.Item(i).EULAText
strHTML = strHTML & VbCrLf & "<br>Handler ID: " & colUpdates.Item(i).HandlerID
Set objIdentity = colUpdates.Item(i).Identity
strHTML = strHTML & VbCrLf & "<br>Revision number: " & objIdentity.RevisionNumber
strHTML = strHTML & VbCrLf & "<br>Update ID: " & objIdentity.UpdateID
Set objInstallationBehavior = colUpdates.Item(i).InstallationBehavior
strHTML = strHTML & VbCrLf & "<br>Can request user input: " & _
objInstallationBehavior.CanRequestUserInput
strHTML = strHTML & VbCrLf & "<br>Impact: " & objInstallationBehavior.Impact
strHTML = strHTML & VbCrLf & "<br>Reboot behavior: " & objInstallationBehavior.RebootBehavior
strHTML = strHTML & VbCrLf & "<br>Requires network connectivity: " & _
objInstallationBehavior.RequiresNetworkConnectivity
strHTML = strHTML & VbCrLf & "<br>Is beta: " & colUpdates.Item(i).IsBeta
strHTML = strHTML & VbCrLf & "<br>Is hidden: " & colUpdates.Item(i).IsHidden
strHTML = strHTML & VbCrLf & "<br>Is installed: " & colUpdates.Item(i).IsInstalled
strHTML = strHTML & VbCrLf & "<br>Is mandatory: " & colUpdates.Item(i).IsMandatory
strHTML = strHTML & VbCrLf & "<br>Is uninstallable: " & colUpdates.Item(i).IsUninstallable
For Each strLanguage in colUpdates.Item(i).Languages
strHTML = strHTML & VbCrLf & "<br>Supported language: " & strLanguage
Next
strHTML = strHTML & VbCrLf & "<br>Last deployment change time: " & _
colUpdates.Item(i).LastDeploymentChangeTime
strHTML = strHTML & VbCrLf & "<br>Maximum download size: " & colUpdates.Item(i).MaxDownloadSize
strHTML = strHTML & VbCrLf & "<br>Minimum download size: " & colUpdates.Item(i).MinDownloadSize
strHTML = strHTML & VbCrLf & "<br>Microsoft Security Response Center severity: " & _
colUpdates.Item(i).MsrcSeverity
strHTML = strHTML & VbCrLf & "<br>Recommended CPU speed: " & _
colUpdates.Item(i).RecommendedCPUSpeed
strHTML = strHTML & VbCrLf & "<br>Recommended hard disk space: " & _
colUpdates.Item(i).RecommendedHardDiskSpace
strHTML = strHTML & VbCrLf & "<br>Recommended memory: " & colUpdates.Item(i).RecommendedMemory
strHTML = strHTML & VbCrLf & "<br>Release notes: " & colUpdates.Item(i).ReleaseNotes
strHTML = strHTML & VbCrLf & "<br>Support URL: " & colUpdates.Item(i).SupportURL
strHTML = strHTML & VbCrLf & "<br>Type: " & colUpdates.Item(i).Type
strHTML = strHTML & VbCrLf & "<br>Uninstallation notes: " & _
colUpdates.Item(i).UninstallationNotes
For Each strArticle in colUpdates.Item(i).KBArticleIDs
strHTML = strHTML & VbCrLf & "<br>KB article: " & strArticle
Next
strHTML = strHTML & VbCrLf & "<br>Deployment action: " & colUpdates.Item(i).DeploymentAction
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHTMLFile = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "Updatecheck.html"
Set objHTMLFile = objFSO.CreateTextFile(strHTMLFile, True)
objHTMLFile.WriteLine "<HTML>"
objHTMLFile.WriteLine "<BODY>"
objHTMLFile.WriteLine strHTML
objHTMLFile.WriteLine "</BODY>"
objHTMLFile.WriteLine "</HTML>"
objHTMLFile.Close
Set objIE = CreateObject("InternetExplorer.Application")
objIE.visible = True
objIE.Navigate2 strHTMLFile
Function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
Hi, I'm very sorry for my late reply. I've been busy.....and a bit unwell....
Anyway, you did a great job with that script. It worked for me. I have tweaked it slightly...
It's a great script too! I didn't think it was that easy to check for updates!
When you say you get a blank page, check that the file "Updatecheck.html" is being created in the same folder as the VBS file, and right-click it, and open with Notepad, to see if there's any text in it.
Regards,
Rob.
Anyway, you did a great job with that script. It worked for me. I have tweaked it slightly...
It's a great script too! I didn't think it was that easy to check for updates!
When you say you get a blank page, check that the file "Updatecheck.html" is being created in the same folder as the VBS file, and right-click it, and open with Notepad, to see if there's any text in it.
Regards,
Rob.
'On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objSearcher = CreateObject("Microsoft.Update.Searcher")
Set objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates
For i = 0 to colUpdates.Count - 1
strHTML = strHTML & VbCrLf & "<br>Title: " & colUpdates.Item(i).Title
strHTML = strHTML & VbCrLf & "<br>Autoselect on Web sites: " & _
colUpdates.Item(i).AutoSelectOnWebSites
For Each strUpdate in colUpdates.Item(i).BundledUpdates
strHTML = strHTML & VbCrLf & "<br>Bundled update: " & strUpdate
Next
strHTML = strHTML & VbCrLf & "<br>Can require source: " & colUpdates.Item(i).CanRequireSource
Set objCategories = colUpdates.Item(i).Categories
For z = 0 to objCategories.Count - 1
strHTML = strHTML & VbCrLf & "<br>Category name: " & objCategories.Item(z).Name
strHTML = strHTML & VbCrLf & "<br>Category ID: " & objCategories.Item(z).CategoryID
For Each strChild in objCategories.Item(z).Children
strHTML = strHTML & VbCrLf & "<br>Child category: " & strChild
Next
strHTML = strHTML & VbCrLf & "<br>Category description: " & _
objCategories.Item(z).Description
strHTML = strHTML & VbCrLf & "<br>Category order: " & objCategories.Item(z).Order
strHTML = strHTML & VbCrLf & "<br>Category type: " & objCategories.Item(z).Type
Next
strHTML = strHTML & VbCrLf & "<br>Deadline: " & colUpdates.Item(i).Deadline
strHTML = strHTML & VbCrLf & "<br>Delta compressed content available: " & _
colUpdates.Item(i).DeltaCompressedContentAvailable
strHTML = strHTML & VbCrLf & "<br>Delta compressed content preferred: " & _
colUpdates.Item(i).DeltaCompressedContentPreferred
strHTML = strHTML & VbCrLf & "<br>Description: " & colUpdates.Item(i).Description
strHTML = strHTML & VbCrLf & "<br>EULA accepted: " & colUpdates.Item(i).EULAAccepted
strHTML = strHTML & VbCrLf & "<br>EULA text: " & colUpdates.Item(i).EULAText
strHTML = strHTML & VbCrLf & "<br>Handler ID: " & colUpdates.Item(i).HandlerID
Set objIdentity = colUpdates.Item(i).Identity
strHTML = strHTML & VbCrLf & "<br>Revision number: " & objIdentity.RevisionNumber
strHTML = strHTML & VbCrLf & "<br>Update ID: " & objIdentity.UpdateID
Set objInstallationBehavior = colUpdates.Item(i).InstallationBehavior
strHTML = strHTML & VbCrLf & "<br>Can request user input: " & _
objInstallationBehavior.CanRequestUserInput
strHTML = strHTML & VbCrLf & "<br>Impact: " & objInstallationBehavior.Impact
strHTML = strHTML & VbCrLf & "<br>Reboot behavior: " & objInstallationBehavior.RebootBehavior
strHTML = strHTML & VbCrLf & "<br>Requires network connectivity: " & _
objInstallationBehavior.RequiresNetworkConnectivity
strHTML = strHTML & VbCrLf & "<br>Is beta: " & colUpdates.Item(i).IsBeta
strHTML = strHTML & VbCrLf & "<br>Is hidden: " & colUpdates.Item(i).IsHidden
strHTML = strHTML & VbCrLf & "<br>Is installed: " & colUpdates.Item(i).IsInstalled
strHTML = strHTML & VbCrLf & "<br>Is mandatory: " & colUpdates.Item(i).IsMandatory
strHTML = strHTML & VbCrLf & "<br>Is uninstallable: " & colUpdates.Item(i).IsUninstallable
strLanguages = ""
For Each strLanguage in colUpdates.Item(i).Languages
If strLanguages = "" Then
strLanguages = strLanguage
Else
strLanguages = strLanguages & ", " & strLanguage
End If
Next
strHTML = strHTML & VbCrLf & "<br>Supported language: " & strLanguages
strHTML = strHTML & VbCrLf & "<br>Last deployment change time: " & _
colUpdates.Item(i).LastDeploymentChangeTime
strHTML = strHTML & VbCrLf & "<br>Maximum download size: " & colUpdates.Item(i).MaxDownloadSize
strHTML = strHTML & VbCrLf & "<br>Minimum download size: " & colUpdates.Item(i).MinDownloadSize
strHTML = strHTML & VbCrLf & "<br>Microsoft Security Response Center severity: " & _
colUpdates.Item(i).MsrcSeverity
strHTML = strHTML & VbCrLf & "<br>Recommended CPU speed: " & _
colUpdates.Item(i).RecommendedCPUSpeed
strHTML = strHTML & VbCrLf & "<br>Recommended hard disk space: " & _
colUpdates.Item(i).RecommendedHardDiskSpace
strHTML = strHTML & VbCrLf & "<br>Recommended memory: " & colUpdates.Item(i).RecommendedMemory
strHTML = strHTML & VbCrLf & "<br>Release notes: " & colUpdates.Item(i).ReleaseNotes
strHTML = strHTML & VbCrLf & "<br>Support URL: " & colUpdates.Item(i).SupportURL
strHTML = strHTML & VbCrLf & "<br>Type: " & colUpdates.Item(i).Type
strHTML = strHTML & VbCrLf & "<br>Uninstallation notes: " & _
colUpdates.Item(i).UninstallationNotes
For Each strArticle in colUpdates.Item(i).KBArticleIDs
strHTML = strHTML & VbCrLf & "<br>KB article: " & strArticle
Next
strHTML = strHTML & VbCrLf & "<br>Deployment action: " & colUpdates.Item(i).DeploymentAction & "<br><br>"
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHTMLFile = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "Updatecheck.html"
Set objHTMLFile = objFSO.CreateTextFile(strHTMLFile, True)
objHTMLFile.WriteLine "<HTML>"
objHTMLFile.WriteLine "<BODY>"
objHTMLFile.WriteLine strHTML
objHTMLFile.WriteLine "</BODY>"
objHTMLFile.WriteLine "</HTML>"
objHTMLFile.Close
Set objIE = CreateObject("InternetExplorer.Application")
objIE.visible = True
objIE.Navigate2 strHTMLFile
Function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
ASKER
Hi RobSampson, i get an error on line 101 ; objHTMLFile.WriteLine strHTML
When i integrate this into my other script (so without the html function) my whole scriptoutput turns blanc! Any suggestions?
When i integrate this into my other script (so without the html function) my whole scriptoutput turns blanc! Any suggestions?
Hi, I take it you're combining this with the script from here:
https://www.experts-exchange.com/questions/23479029/Help-needed-with-script.html
I'll have a look at testing it in about an hour or so....
Regards,
Rob.
https://www.experts-exchange.com/questions/23479029/Help-needed-with-script.html
I'll have a look at testing it in about an hour or so....
Regards,
Rob.
ASKER
Hi RobSampson, thats correct, the latest build has far more features. It will be a big script to check machines in a heartbeat!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Sorry for late reaction, it does work on several workstation, but on some others it doens't.. anyway, your time, your points ;)
Thanks for the grade.
On those machines that it doesn't work, you may find that it works if your log on as an Administrator.
Two reasons I can think of why it might not work...
1) The user who has logged on does not have rights to read those Win32 classes
2) The user may have proxy restricitions for the microsoft update website
Regards,
Rob.
On those machines that it doesn't work, you may find that it works if your log on as an Administrator.
Two reasons I can think of why it might not work...
1) The user who has logged on does not have rights to read those Win32 classes
2) The user may have proxy restricitions for the microsoft update website
Regards,
Rob.
Couldn't you just browse to
http://windowsupdate.microsoft.com
and follow the prompts?
Otherwise, you could set up a WSUS Server to control the updates pushed to your organisation.
http://technet.microsoft.com/en-us/wsus/default.aspx
Regards,
Rob.