Specifying Update Categories to Synchronize
Applies To: Windows Server Update Services
An update category defines the category of products for which you want to receive updates. There are three types of update categories: company, product family, and product.
The root category is the company category. The company category can have one or more subcategories known as product family categories. Product family categories contain one or more product categories. For example, the company category for Microsoft is Microsoft Corporation. The Microsoft Corporation category contains the Windows product family category, which in turn contains product categories, such as the Windows Server 2003 family and the family.
To retrieve a list of possible company, product family, and product categories, call IUpdateServer.GetRootUpdateCategories and iterate through each category's subcategories as shown in the following example.
{
IUpdateServer server = AdminProxy.GetUpdateServer();
DisplayCategories(server.GetRootUpdateCategories());
}
//For the given collection, print the categories and their descendants.
//The subcategories are indented under their parents.
static void DisplayCategories(UpdateCategoryCollection categories)
{
foreach (IUpdateCategory category in categories)
{
//Use the category's type to indent.
switch (category.Type)
{
case UpdateCategoryType.Company:
Console.WriteLine();
break;
case UpdateCategoryType.ProductFamily:
Console.Write(" ");
break;
case UpdateCategoryType.Product:
Console.Write(" ");
break;
}
Console.WriteLine(category.Title);
//Recursively call this method for each category
//that contains subcategories.
if (category.ProhibitsSubcategories == false)
{
DisplayCategories(category.GetSubcategories());
}
}
}
To specify the categories of product updates that you want to receive, call ISubscription.SetUpdateCategories. To create the collection of categories that you pass to SetUpdateCategories, you can either:
Call ISubscription.GetUpdateCategories and add or remove categories from the collection as appropriate.
Create and populate a new category collection to pass to SetUpdateCategories as shown in the Specifying Updates to Synchronize example.
You should not include related parent child categories in the collection. For example, you should not include the Windows product family category and family product in the same collection. However, you can specify the Office product family and family product in the same collection because they are not related. If the collection contains related parent child categories, WSUS ignores the child categories and synchronizes all the products for the parent category. For example, if the collection includes Windows and family, WSUS ignores the family product category and synchronizes all Windows products.
If the collection contains a company or product family category, all products are synchronized. If a product is added in the future, the new product is automatically included in the list of products to synchronize. For example, if the collection contains the product family category, Windows, all current and future operating system product categories are synchronized. If the collection contains the company category, Microsoft Corporation, all products for all product families under Microsoft Corporation are synchronized.
If you want to prevent WSUS from automatically adding future products to the list of products being synchronized, you should use product categories only.
When Microsoft Update defines a new category, the new category is automatically downloaded to the WSUS server during the synchronization process. To determine the categories that were added since you last updated the synchronization settings, call IUpdateServer.GetUpdateCategories(DateTime, DateTime). Set the fromSyncDate parameter to ISubscription.LastModifiedTime. Use IUpdateCategory.Type to determine the type of the new categories that were added.