Skip to content

Instantly share code, notes, and snippets.

@Laffs2k5
Laffs2k5 / win-updates.ps1
Created August 15, 2017 08:04 — forked from joefitzgerald/win-updates.ps1
Install All Windows Updates, Rebooting As Many Times As Required
param($global:RestartRequired=0,
$global:MoreUpdates=0,
$global:MaxCycles=10)
function Check-ContinueRestartOrEnd() {
$RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$RegistryEntry = "InstallWindowsUpdates"
switch ($global:RestartRequired) {
0 {
$prop = (Get-ItemProperty $RegistryKey).$RegistryEntry