Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Created November 15, 2014 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaykul/a0596ef62d04002fa233 to your computer and use it in GitHub Desktop.
Save Jaykul/a0596ef62d04002fa233 to your computer and use it in GitHub Desktop.
Remote Windows Updates
param(
[string[]]$ComputerName = ".",
[Parameter(Mandatory)]
[Management.Automation.Credential()]
[PSCredential]$Credential
)
$sessions = New-PSSession -ComputerName:$ComputerName -Credential:$Credential
Invoke-Command -Session $sessions {
$wua = New-Object -Com Microsoft.Update.Session
$search = $wua.CreateUpdateSearcher()
$result = $search.Search("Type='Software'")
$result.Updates | Where IsInstalled -eq $False
} | fl PSComputerName, Title, Description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment