Hello,
We've been facing an issue recently where servers maybe need 2+ reboots post patching which is being missed. I've managed to create a SAM Powershell alert using the following code (should anyone else want it), however is there a cleaner, neater way to do this?
if ((Invoke-WmiMethod -ComputerName localhost -Namespace "ROOT\ccm\ClientSDK" -Class CCM_ClientUtilities -Name DetermineIfRebootPending | select-object -ExpandProperty "RebootPending") -eq $true) {Write-Host "Message:Reboot Pending"; Write-Host "Statistic:1"} else {Write-Host "Message:No Reboot Pending"; Write-Host "Statistic:0"}
Thanks,
Peter