Monthly Archive

Windows Updates: remote machines


My main blog is now at but I also maintain as a mirror and in case I want the two to diverge at some point.

My recent posts on accessing Windows updates – especially when testing for available updates have raised a number of comments

One very interesting question is about getting information on the state of updates on remote machines.

We are using COM classes in these functions. It is possible for programmers to access COM objects on remote machines but it isn’t an easy proposition in PowerShell. The best way round this I can think of is to do something like this

get-qadcomputer |
foreach {
invoke-command -filepath c:\scripts\getupdates.ps1 -ComputerName $_.Name


The getupdates script would contain this code

$session = New-Object -ComObject Microsoft.Update.Session            
$searcher = $session.CreateUpdateSearcher()            
$result = $searcher.Search("IsInstalled=0 and Type='Software' and ISHidden=0" )            
if ($result.Updates.Count -gt 0){            
 $result.Updates |             
 select Title, IsHidden, IsDownloaded, IsMandatory,             
 IsUninstallable, RebootRequired, Description            
else {            
 Write-Host " No updates available"            

Alternatively leave it as a function and add a call to the function as the last line of the script. I’ll be returning to this idea in a little while as I want to do some more on automating updates across my test environment

Leave a Reply