Hello all,
i am trying for a long time to monitor al my windows server if they are up to date on the last update of there is pending updates.
i build the following PowerShell script:
$AllUpdates= @()
$AllObjects = @()
#Check for update
$WUcheck = Get-WUList
$KBs = $WUcheck |select KB |where {$_.KB -Match "KB"}
$UpdateName = $WUcheck |select Title |where {$_.Title -match "(KB)"}
$Updates = $WUcheck |select KB, Title |where {$_.KB -Match "KB" }
if ($WUcheck -eq $null){
$obj = New-Object PSCustomObject
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNAME" -Value $Null
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNUMBER" -Value 0
$AllObjects += $obj
}
else{
foreach ($Update in $Updates){
$obj = New-Object PSCustomObject
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNAME" -Value $Update.Title
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNUMBER" -Value $Update.KB
$AllObjects += $obj
}
}
$AllObjectsJSON = $AllObjects| select @{N='{#UPNAME}'; E={$_.UPNAME}},@{N='{#UPNUMBER}'; E={$_.UPNUMBER}}
write-host "{"
write-host " `"data`":`n"
convertto-json $AllObjectsJSON
write-host "}"
on zabbix i am getting the the following error attach
the user parameter that i am using is :
UserParameter=GetPendingUpdates[*],%SystemRoot%\system32\WindowsPowerShell\v1.0\powe rshell.exe -nologo -command “& "c:\Program Files\Zabbix Agent\scripts\check Windows Update for zabix.ps1" $1”
please help to solve this.
i am trying for a long time to monitor al my windows server if they are up to date on the last update of there is pending updates.
i build the following PowerShell script:
$AllUpdates= @()
$AllObjects = @()
#Check for update
$WUcheck = Get-WUList
$KBs = $WUcheck |select KB |where {$_.KB -Match "KB"}
$UpdateName = $WUcheck |select Title |where {$_.Title -match "(KB)"}
$Updates = $WUcheck |select KB, Title |where {$_.KB -Match "KB" }
if ($WUcheck -eq $null){
$obj = New-Object PSCustomObject
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNAME" -Value $Null
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNUMBER" -Value 0
$AllObjects += $obj
}
else{
foreach ($Update in $Updates){
$obj = New-Object PSCustomObject
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNAME" -Value $Update.Title
Add-Member -InputObject $obj -MemberType NoteProperty -Name "UPNUMBER" -Value $Update.KB
$AllObjects += $obj
}
}
$AllObjectsJSON = $AllObjects| select @{N='{#UPNAME}'; E={$_.UPNAME}},@{N='{#UPNUMBER}'; E={$_.UPNUMBER}}
write-host "{"
write-host " `"data`":`n"
convertto-json $AllObjectsJSON
write-host "}"
on zabbix i am getting the the following error attach
the user parameter that i am using is :
UserParameter=GetPendingUpdates[*],%SystemRoot%\system32\WindowsPowerShell\v1.0\powe rshell.exe -nologo -command “& "c:\Program Files\Zabbix Agent\scripts\check Windows Update for zabix.ps1" $1”
please help to solve this.

Comment