Reporting Installation Status Totals by Client

 

Applies To: Windows Server Update Services

The following example shows how to retrieve summary installation totals by client. For example, the totals reflect the number of updates installed on the client. Those updates that are not specifically deployed to the given client are reflected in the UnknownCount summary total.

IUpdateServer server = AdminProxy.GetUpdateServer();  
  
//Retrieve the All Computers target group.  
IComputerTargetGroup allComputersGroup = server.GetComputerTargetGroup(ComputerTargetGroupId.AllComputers);  
  
//Retrieve the summary installation totals for each client.  
foreach (IUpdateSummary summary in allComputersGroup.GetTotalSummaryPerComputerTarget())  
{  
  Console.WriteLine("Client: {0}\nInstalled: {1}\nPending restart: {2}" +  
                    "\nDownloaded: {3}\nNot installed: {4}\nFailed: {5}\n" +  
                    "\nNot applicable: {6}\nUnknown: {7}\n",   
                    server.GetComputerTarget(summary.ComputerId).FullDomainName,  
                    summary.InstalledCount, summary.InstalledPendingRebootCount,  
                    summary.DownloadedCount, summary.NotInstalledCount,   
                    summary.FailedCount, summary.NotApplicableCount,  
                    summary.UnknownCount);  
}