Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
 Opt-In to Microsoft Update
Opt-In to Microsoft Update

You can opt a computer in to the Microsoft Update service and then register that service with Automatic Updates.

The scripting sample in this topic shows you how to use Windows Update Agent (WUA) to register the Microsoft Update service with Automatic Updates. Alternatively, to register the service, the user can visit Microsoft Update.

Before you attempt to run this sample, verify that the version of WUA that is installed on the computer is version 7.0.6000 or a later version. For more information about how to determine the version of WUA that is installed, see Determining the Current Version of WUA.

Example

The following scripting sample shows you how to use the Windows Update Agent (WUA) to register the Microsoft Update service with Automatic Updates. The sample allows deferred or offline processing if needed.


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,"")


In earlier versions of WUA (a minimum WUA version of 7.0.6000), you can simplify the opt-in process by using a registry setting. After the registry key and values are configured, the Microsoft Update opt-in process occurs the next time WUA performs a search. The opt-in process may be triggered by Automatic Updates or by an API caller.

For example, the full path of the registry key and values to set for the opt-in process are as follows:

HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\PendingServiceRegistration\7971f918-a847-4430-9279-4a52d1efe18d

ClientApplicationID = My App

RegisterWithAU = 1

Note  

The registry key is respected once only when WUA is updated from a version that is earlier than version 7.0.6000 to version 7.0.6000 or to a later version. We recommend discretion when overwriting existing registry values because overwriting the values may change the result of an earlier service registration request.

Creating this registry key requires administrative credentials. For Windows Vista, the caller must create the registry key in an elevated process.

 

 

Send comments about this topic to Microsoft

Build date: 7/7/2011

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
No auto-updates      That Guy 539   |   Edit   |   Show History
This is great....but how can I set it so that it doesn't enable auto-updates?

I just need the update components to be loaded...but the auto-updates should be disabled.
Tags What's this?: Add a tag
Flag as ContentBug
Permission solution      rseiler   |   Edit   |   Show History
Run the script from an administrative command prompt.
Tags What's this?: Add a tag
Flag as ContentBug
Permission denied error      JohnSimke   |   Edit   |   Show History
I get persmission denied error on line 5
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker