Automate Windows Update to use Microsoft Update

Sometimes it is desired to set Windows Update on client devices to look at Microsoft Update instead.
Through the GUI this will take some clicks, where I would always like to automate these thingsā€¦
This can be done either by setting a registry key, or you could just use a script.

Registry
Registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\PendingServiceRegistration\7971f918-a847-4430-9279-4a52d1efe18d
Registry name: ClientApplicationID (REG_SZ)
Registry value: My App

Registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\PendingServiceRegistration\7971f918-a847-4430-9279-4a52d1efe18d
Registry name: RegisterWithAU (REG_SZ)
Registry value: 1

Script (VBS):
Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
‘add the Microsoft Update Service, GUID
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")

This post is based on: http://msdn.microsoft.com/en-us/library/windows/desktop/aa826676(v=vs.85).aspx

Leave a Reply

Your email address will not be published. Required fields are marked *