Skip to content

Instantly share code, notes, and snippets.

@simstems
Last active August 12, 2025 19:32
Show Gist options
  • Save simstems/ddf883c764c3ae26106703c56746f860 to your computer and use it in GitHub Desktop.
Save simstems/ddf883c764c3ae26106703c56746f860 to your computer and use it in GitHub Desktop.
Run updates on a list of remote systems.
$namesList = @(
"[PC-NAME]",
"[PC-NAME]",
"[PC-NAME]",
)
foreach ($name in $namesList) {
Enter-PSSession -ComputerName $name
gpupdate /force
# Install-Module -Name PSWindowsUpdate -Force
# Start-Sleep -Seconds 5
Import-Module PSWindowsUpdate
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
Start-Sleep -Seconds 60
# Restart-Computer -Force
exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment