Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Created November 15, 2014 00:34
Show Gist options
  • 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