I thought this was cute and was surprised I get spotify updates on my PC [I don't even use it] :o
; Winbatch 2021 - quick PS Gridview of Installed Updates
; Stan Littlefield 6/3/2021
;==========================================================================================================
IntControl(73,1,0,0,0)
gosub udfs
cScript= $"
Get-WinEvent -FilterHashTable @{
ID=19
ProviderName='Microsoft-Windows-WindowsUpdateClient'
} | Select-Object -Property TimeCreated, Message | Out-GridView -Title "Windows Installed Updates"
$"
BoxOpen("Please Wait","Obtaining Installed Updates")
oNoGo = ObjectType("BOOL",@FALSE)
ObjectClrOption("useany", "System.Management.Automation")
objAutoPs = ObjectClrNew("System.Management.Automation.PowerShell")
oPshell = objAutoPs.Create()
oScope = ObjectType("BOOL",@TRUE)
oPshell.AddScript(cScript,oScope)
objAsync = oPshell.BeginInvoke()
ctimeout=100
tries=0
While objAsync.IsCompleted == oNoGo
TimeDelay(10)
tries=tries+1
If tries>ctimeout Then Break
EndWhile
oPShell.EndInvoke(objAsync)
BoxShut()
While WinExist("Windows Installed Updates")
Timedelay(1)
EndWhile
Exit
;======================================================================================================
:WBERRORHANDLER
Terminate(@TRUE,"Error Encountered",err())
;======================================================================================================
:udfs
#DefineSubRoutine err()
If key<>0 Then RegCloseKey(key)
wberroradditionalinfo = wberrorarray[6]
lasterr = wberrorarray[0]
handlerline = wberrorarray[1]
textstring = wberrorarray[5]
linenumber = wberrorarray[8]
errmsg = "Error: ":lasterr:@LF:textstring:@LF:"Line (":linenumber:")":@LF:wberroradditionalinfo
Return(errmsg)
#EndSubRoutine
Return
;===========================================================================================
Just add a filter and the script below returns updates for installed software:
; Winbatch 2021 - quick PS Gridview of Installed Updates
; Stan Littlefield 6/3/2021
;==========================================================================================================
IntControl(73,1,0,0,0)
gosub udfs
cScript= $"
$software = @{
Name = 'Software'
Expression = { $_.Properties[0].Value }
}
Get-WinEvent -FilterHashTable @{
Logname='System'
ID=19
ProviderName='Microsoft-Windows-WindowsUpdateClient'
} | Select-Object -Property TimeCreated, $software | Out-GridView -Title "Windows Installed Updates"
$"
BoxOpen("Please Wait","Obtaining Installed Software Updates")
oNoGo = ObjectType("BOOL",@FALSE)
ObjectClrOption("useany", "System.Management.Automation")
objAutoPs = ObjectClrNew("System.Management.Automation.PowerShell")
oPshell = objAutoPs.Create()
oScope = ObjectType("BOOL",@TRUE)
oPshell.AddScript(cScript,oScope)
objAsync = oPshell.BeginInvoke()
ctimeout=100
tries=0
While objAsync.IsCompleted == oNoGo
TimeDelay(10)
tries=tries+1
If tries>ctimeout Then Break
EndWhile
oPShell.EndInvoke(objAsync)
BoxShut()
While WinExist("Windows Installed Updates")
Timedelay(1)
EndWhile
Exit
;======================================================================================================
:WBERRORHANDLER
Terminate(@TRUE,"Error Encountered",err())
;======================================================================================================
:udfs
#DefineSubRoutine err()
If key<>0 Then RegCloseKey(key)
wberroradditionalinfo = wberrorarray[6]
lasterr = wberrorarray[0]
handlerline = wberrorarray[1]
textstring = wberrorarray[5]
linenumber = wberrorarray[8]
errmsg = "Error: ":lasterr:@LF:textstring:@LF:"Line (":linenumber:")":@LF:wberroradditionalinfo
Return(errmsg)
#EndSubRoutine
Return
;===========================================================================================