Sie sind hier: Weblog

PowerShell-Tipp: Windows-Update-Einstellungen per Skript ändern

Foto Dr. Holger Schwichtenberg, Dr. Holger Schwichtenberg
04.08.2011 14:57:00

Mit einem kurzen PowerShell-Skript kann man die Einstellungen für Windows-Update verändern. Dabei greift man auf die COM-Klasse Microsoft.Update.AutoUpdate zurück.

$updateObj = New-Object -ComObject "Microsoft.Update.AutoUpdate"
"Bisheriger NotificationLevel: $($updateObj.Settings.NotificationLevel)"
$updateObj.Settings.NotificationLevel = 2

# ' 0 = Never Check for Updates
# ' 1 = Download/Choose whether to install them
# ' 2 = Download/Choose whether to download and install them
# ' 3 = Install automatically

"Neuer NotificationLevel: $($updateObj.Settings.NotificationLevel)"
$updateObj.Settings.Save()

Auch weitere Einstellungen wie den Installationszeitpunkt kann man auslesen und verändern über

$updateObj.Settings.ScheduledInstallationDay
$updateObj.Settings.ScheduledInstallationTime

Alternativ kann man auch den Windows-Dialog für Windows Update öffnen:

$updateObj.ShowSettingsDialog()


()