Using the Windows Server Update Services 3.0 Class Library

The IUpdateServer interface is the main entry point for the WSUS API. To retrieve an IUpdateServer instance, call GetUpdateServer. Then, set PreferredCulture to the locale in which you want WSUS to return strings.

Permissions for using the WSUS 3.0 API

In order to use the WSUS 3.0 API, you must be a member of the WSUS Reporters group or the WSUS Administrators group. If you want to perform certain administrative actions, you must be a member of the WSUS Administrators group. If a method requires administrative permissions, there will be a note in the Remarks section of the reference documentation for that method.

Using the WSUS 3.0 API remotely

If you are planning to use the WSUS 3.0 API to contact a remote WSUS 3.0 server, you will need to use one of the AdminProxy methods that specify the name of the remote server machine. The following example establishes a connection with a WSUS 3.0 server named "MyWsusServer" using SSL on port 443:

IUpdateServer server = AdminProxy.GetUpdateServer("MyWsusServer", true, 443);


The following example shows how to retrieve an instance of the IUpdateServer interface and to set the PreferredCulture property.

IUpdateServer server = AdminProxy.GetUpdateServer();
IUpdateServerConfiguration configuration = server.GetConfiguration();
System.Collections.Specialized.StringCollection supportedLanguages = configuration.SupportedUpdateLanguages;
String clientLanguageCode = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; //is of the form, "en-US"
if (supportedLanguages.Contains(clientLanguageCode.ToLower()))
    server.PreferredCulture = clientLanguageCode;
    clientLanguageCode = System.Threading.Thread.CurrentThread.CurrentUICulture.Parent.Name; //is of the form, "en"
    if (supportedLanguages.Contains(clientLanguageCode.ToLower()))
        server.PreferredCulture = clientLanguageCode;
        server.PreferredCulture = "en"; //default to English

After retrieving the IUpdateServer interface and setting the PreferredCulture property, you can use the WSUS API to perform the following tasks or other tasks:

For information on referencing the WSUS assembly, see Referencing the Update Services Assembly.

If you have a client with a 3.0 version of the WSUS API, and the WSUS server's version is later than 3.0, the server will throw a WebException when the client attempts to connect to it.

© 2014 Microsoft