Last active
April 13, 2017 15:21
-
-
Save jeffgreenca/e8ca99641ce7c4d7da66dcc36a7238cb to your computer and use it in GitHub Desktop.
Groan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Usage: psexec @target-computer-list.txt -u "username" cscript \\share\get-update-history.vbs | |
'Unfortunately, nicer methods like PowerShell Get-Hotfix / WMI query to Win32_QuickFixEngineering does not capture a complete list of updates | |
'If you have servers with various versions of .NET, PowerShell, without PowerShell, and they aren't all under SCCM or some other kind of centralized management, this might be your best shot at reporting updates. | |
'This method will get everything, but then needs to be parsed for Operation (not necessarily an Install), and result (not necessarily successful) | |
'Extracting a KB number is basically just a regex for the content between ( and ) | |
'For more, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa387291(v=vs.85).aspx and https://msdn.microsoft.com/en-us/library/windows/desktop/aa386077(v=vs.85).aspx | |
Dim o | |
Set o = CreateObject("Microsoft.Update.Session") | |
Set s = o.CreateUpdateSearcher() | |
count = s.GetTotalHistoryCount() | |
Set updates = s.QueryHistory(0, count) | |
On Error Resume Next | |
Set wshNetwork = WScript.CreateObject( "WScript.Network" ) | |
hostid = wshNetwork.ComputerName | |
For i = 0 to count | |
title = "" | |
operation = "" | |
hresult = "" | |
mydate = "" | |
title = updates(i).title | |
operation = cstr(updates(i).operation) | |
mydate = cstr(updates(i).date) | |
hresult = cstr(updates(i).hresult) | |
WScript.Echo hostid, VBTab, title, VBTab, mydate, VBTab, operation, VBTab, hresult | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment