Using WSUS
The IUpdateServer interface is the main entry point for the WSUS API. To retrieve an IUpdateServer instance, call AdminProxy.GetUpdateServer. Then, set IUpdateServer.PreferredCulture to the locale in which you want WSUS to return strings.
The following example shows how to retrieve an instance of the IUpdateServer interface and to set the IUpdateServer.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; else { clientLanguageCode = System.Threading.Thread.CurrentThread.CurrentUICulture.Parent.Name; //is of the form, "en" if (supportedLanguages.Contains(clientLanguageCode.ToLower())) server.PreferredCulture = clientLanguageCode; else server.PreferredCulture = "en"; //default to English }
After retrieving the IUpdateServer interface and setting the IUpdateServer.PreferredCulture property, you can use the WSUS API to perform the following tasks or other tasks:
- Specify updates to synchronize.
- Reporting updates needed by clients.
- Approving deployment of an update to a group of computers.
- Retrieving update installation status.
For information on referencing the WSUS assembly, see Referencing the Update Services Assembly.