The following code or query in powershell allows me to find the number of updates that is needed for a local computer. Is there another way for me to specify which server I want to look at for the number of windows updates. Using -Computername in combination with these script does nothing but gives me error.
$Criteria = "IsInstalled=0 and Type='Software'"
$Searcher = New-Object -ComObject Microsoft.Update.Searcher
$SearchResults = $Searcher.Search($Criteria).Updates
$SearchResults.Count
You can run the code on a remote host via
Invoke-Command
:Change the last line to
if you want hostname and number of updates returned instead of just the number of updates.