Recently I got a question from a student who wanted to have two collections for each software deployment. 1 collection containing computer that ran the advertisement successfully; and 1 collection for those who failed.

There can be several ways to solve this puzzle. In my example I look at the status messages coming from the client.

In order to use this solution you first need to find the advertisement ID for the deployment. Navigate to the advertisement and make a note of the advertisement ID. In my example the advertisement ID is A0120005

image

Next create two query based collections and use these WQL statements:

Collection for a successful installation:
select sys.ResourceID,sys.ResourceType,sys.Name,sys.SMSUniqueIdentifier,sys.ResourceDomainORWorkgroup,sys.Client from sms_r_system as sys inner join SMS_ClientAdvertisementStatus as offer on sys.ResourceID=offer.ResourceID  WHERE AdvertisementID = 'A0120005' and LastStateName = 'Succeeded'

Collection for a failed installation:
select sys.ResourceID,sys.ResourceType,sys.Name,sys.SMSUniqueIdentifier,sys.ResourceDomainORWorkgroup,sys.Client from sms_r_system as sys inner join SMS_ClientAdvertisementStatus as offer on sys.ResourceID=offer.ResourceID  WHERE AdvertisementID = 'A0120005' and LastStateName = 'Failed'