Help Modifying Script To Retrieve Last Windows Update Date and Time From Computers.
Home › Forums › Scripting › Windows Script Host › Help Modifying Script To Retrieve Last Windows Update Date and Time From Computers.
- This topic has 7 replies, 3 voices, and was last updated 7 years, 6 months ago by
Shazam.
-
AuthorPosts
-
ShazamMemberJul 01, 2013 at 3:39 pm #161841Hi Everyone,
I got this VBS code from this link below.
Can this script be modify to output the results to a CSV or Text file?
Currently the results shows in a dialog box.
Thanks!
‘Script pulls last Windows update info from registry of all computers specified in computers text file and echos on screen
On Error Resume Next
Set objGetComputerList = CreateObject(“Scripting.FileSystemObject”)
Set fsoReadComputerList = objGetComputerList.OpenTextFile(“computers.txt”, 1, TristateFalse)
aryServers = Split(fsoReadComputerList.ReadAll, vbCrLf)
fsoReadComputerList.CloseFor Each strComputer In aryServers
Const HKEY_LOCAL_COMPUTER = &H80000002
strKeyPath = “SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall”
strEntryName = “LastSuccessTime”
Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & _
strComputer & “rootdefault:StdRegProv”)
objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
Wscript.Echo(strComputer & ” ” & strValue)Next[/CODE][CODE]’Script pulls last Windows update info from registry of all computers specified in computers text file and echos on screen
On Error Resume Next
Set objGetComputerList = CreateObject(“Scripting.FileSystemObject”)
Set fsoReadComputerList = objGetComputerList.OpenTextFile(“computers.txt”, 1, TristateFalse)
aryServers = Split(fsoReadComputerList.ReadAll, vbCrLf)
fsoReadComputerList.CloseFor Each strComputer In aryServers
Const HKEY_LOCAL_COMPUTER = &H80000002
strKeyPath = “SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall”
strEntryName = “LastSuccessTime”
Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & _
strComputer & “rootdefault:StdRegProv”)
objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
Wscript.Echo(strComputer & ” ” & strValue)Next[/CODE]
-
AuthorPosts
You must be logged in to reply to this topic.