Daniel's Windows World

Experiences on Windows Client made by Daniel, Solution Specialist at Microsoft Australia

Enabling and Disabling Microsoft Update in Windows 7 via Script

Enabling and Disabling Microsoft Update in Windows 7 via Script

  • Comments 8
  • Likes

The Windows Update Feature in Windows 7 allows administrators to configure it to either service Windows only or to extend it to other products from Microsoft Update. In most cases, Windows Update is used by end-users only with no need to automate or script this process, since larger organisations usually utilise other means like System Center Configuration Manager to keep their systems up to date.

image

In some cases, however, you actually do get into the position where you want (or need) to change this setting for your end users, so scripting it can come in handy.

How to do this is documented here: http://msdn.microsoft.com/en-us/library/aa826676(VS.85).aspx and can be achieved via a simple script:

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

The reverse step is also possible with a simple alteration:

Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
'remove the Microsoft Update Service by GUID
ServiceManager.RemoveService("7971f918-a847-4430-9279-4a52d1efe18d")

Comments
  • any chance to let this script do it's work via GPO to automatically deploy the change from Windows Update to Microsoft Update ?

    On my side it only succeeded when running it manually as administrator but not when running via gpo-login-skript :-(

    Ove

  • @Ove - May be this is helpful? myitforum.com/.../workaround-for-installing-office-updates-during-an-image-build

  • This helped me fix my machine which I had updated from Win7 to Win8 and was unable to get WU to work.  Thank you.

  • Worked perfectly

  • This is an excellent script for those of us who got rid of Internet Explorer (a major security hole in the default install), but can no longer change the "Get updates for other Microsoft products" - the link is not doing anything since it relies on iexplorer.exe and even if you visit the link it will only allow you to change the setting in Internet Explorer not any other broweser like Chrome or Firefox.

    Just in case it's not clear for regular users: open Notepad, save the contents of the first script as "script.vbs" (without any extra .txt extension !), open a command prompt as Administrator, change directory to where you saved the script, and run it by typing script.vbs at the prompt. There is no output but you will see the checkbox "Give me updates for Microsoft products and check for new optional Microsoft software when I update Windows" inside the Windows Update settings dialog.

  • Great post, thanks!

  • Wonderfull job!!!
    This script is usefull with Office 2013 after using a image disk with sysprep.
    sysprep killed Microsoft Update in Windows Update.

  • You may use PowerShell to achive the same. Although it did not work for me on a Server 2012 R2 (IsPendingRegistrationWithAU = $true)

    No need to create a file. Simply paste in elevated PowerShell prompt:

    $ServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager"
    $ServiceManager.ClientApplicationID = "My App"
    $ServiceManager.AddService2( "7971f918-a847-4430-9279-4a52d1efe18d",7,"")

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment