Getting the Windows automatic update prompt to appear (inc. RDP sessions)

Often the Windows update shield in the system tray won’t appear when you RDP into systems. A fairly reliable trick seems to be the following:

  1. Stop the Automatic Update service ( ”net stop wuauserv” from the command line ).
  2. Set the ”NextFeaturedUpdatesNotificationTime” key ( located at ”HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\” ) to a date and time slightly ahead (say a minute or two) of the present.
  3. Start the Automatic Update service ( ”net start wuauserv” ).

Or use this script (save as .vbs):

Dim newDate, newDateFormatted, newYear, newMonth, newDay, newHour, newMinute, newSecond, notificationString, strHTML
Dim objExplorer, objWshShell, objWMIService, objService

newDate = DateAdd("n", 2, Now)

newYear = Year(newDate)
newMonth = zeropad(Month(newDate), 2)
newDay = zeropad(Day(newDate), 2)
newHour = zeropad(Hour(newDate), 2)
newMinute = zeropad(Minute(newDate), 2)
newSecond = zeropad(Second(newDate), 2)

newDateFormatted = newYear & "-" & newMonth & "-" & newDay & " " & newHour & ":" & newMinute & ":" & newSecond

Private Function zeroPad(m, t)
zeroPad = String(t-Len(m),"0")&m
End Function

Set objExplorer = CreateObject("InternetExplorer.Application")

objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 200
objExplorer.Visible = 1
objExplorer.Document.Title = "Kicking Updater"

Set objWshShell = CreateObject( "WScript.Shell" )
Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
Set objService = objWMIService.Get("Win32_Service.Name='wuauserv'")
objService.StopService()

While objService.Started
strHTML = strHTML & "<p>Waiting for wuauserv service to stop</p>"
objExplorer.Document.Body.InnerHTML = strHTML
WScript.Sleep 1000
Set objService = objWMIService.Get("Win32_Service.Name='wuauserv'")
Wend

objWshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\NextFeaturedUpdatesNotificationTime", newDateFormatted, "REG_SZ"
strHTML = strHTML & "</p>NextFeaturedUpdatesNotificationTime set to " & newDateFormatted & "</p>"
objExplorer.Document.Body.InnerHTML = strHTML

objService.StartService()

While Not objService.Started
strHTML = strHTML & "<p>Waiting for wuauserv service to start</p>"
objExplorer.Document.Body.InnerHTML = strHTML
WScript.Sleep 1000
Set objService = objWMIService.Get("Win32_Service.Name='wuauserv'")
Wend

strHTML = strHTML & "<p>Finished. The Update notifier should pop up in the tray at " & FormatDateTime(newDate, 3) & "</p>"
objExplorer.Document.Body.InnerHTML = strHTML

Set objService = Nothing
Set objWMIService = Nothing
Set objWshShell = Nothing
Set objExplorer = Nothing

Wscript.Quit