Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remote Windows Updates Query

$
0
0

I found this code and am wondering where I can add a variable or how to query a remote machine with the below (I would like to do it throughout the AD OU tree):

#Get All Assigned updates in $SearchResult
$UpdateSession = New-Object -ComObject Microsoft.Update.Session
#$UpdateSession = New-Object("Microsoft.Update.Session")
$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
$SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")

#Matrix Results for type of updates that are needed
$Critical = $SearchResult.updates | where { $_.MsrcSeverity -eq "Critical" }
$important = $SearchResult.updates | where { $_.MsrcSeverity -eq "Important" }
$other = $SearchResult.updates | where { $_.MsrcSeverity -eq $null }

#Write Results
Write-Host "total=$($SearchResult.updates.count)"
Write-Host "critical=$($Critical.count)"
Write-Host "important=$($Important.count)"
Write-Host "other=$($other.count)"


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>