Reporting Installation Status Totals by Target Group

 

Applies To: Windows Server Update Services

The following example shows how to use IComputerTargetGroup.GetTotalSummary() to retrieve the installation count totals for a target group. The totals reflect the installation state of all occurrences of each update approved for deployment to the group. For example, the InstalledCount summary total reflects the number of occurrences of each update that is installed in the group. If Update A is installed on five clients and Update B is installed on three clients, then the InstalledCount for the group is eight (assuming Update A and Update B are the only updates deployed to the group).

IUpdateServer server = AdminProxy.GetUpdateServer();

//Retrieve each group.
foreach (IComputerTargetGroup group in server.GetComputerTargetGroups())
{
  //For each group, retrieve the summary installation count totals.
  IUpdateSummary totalsSummary = group.GetTotalSummary();

  Console.WriteLine("Group: {0}\nInstalled: {1}\nPending restart:{2}\nDownloaded: {3}" +
                    "\nNot installed: {4}\nFailed: {5}\nNot applicable: {6}" +
                    "\nUnknown: {7}\n", 
                    group.Name,  
                    totalsSummary.InstalledCount, totalsSummary.InstalledPendingRebootCount,
                    totalsSummary.DownloadedCount, totalsSummary.NotInstalledCount, 
                    totalsSummary.FailedCount, totalsSummary.NotApplicableCount,
                    totalsSummary.UnknownCount);

}