Controlling Automatic Updates Installation Time

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell

To find out when Automatic Updates wakes your PC to install new updates, here is a script that will retrieve that information:

$updateObj = New-Object -ComObject Microsoft.Update.AutoUpdate
$day = $updateObj.Settings.ScheduledInstallationDay
$hour = $updateObj.Settings.ScheduledInstallationTime
$level = $updateObj.Settings.NotificationLevel

if ($level -eq 4) {
  if ($day -eq 0) {
    $weekday = 'every day'
  } else {
    $weekday = [System.DayOfWeek]($day-1)
  "Automatic updates installed $weekday at $hour o'clock."
} else {
  'Updates will not be installed automatically. Check update settings for more info.'

To double-check settings or change them via UI, open the appropriate control like this:

$updateObj = New-Object -ComObject Microsoft.Update.AutoUpdate

Twitter This Tip! ReTweet this Tip!

Posted Nov 03 2011, 06:00 AM by ps1
Copyright 2012 All rights reserved.