SMS collection based on advertisement ID or with status

Here is the collection that gives you a list of machines with specific staus message ID:

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 = 'GSA2035F' and LastStatusMessageID = 10009

10009  is success, replace advertisementID with your advertisement ID.

With specific State name:

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 = 'KBS00289' and LastStateName = "Failed"

Below are the list of status messages with the discription:

SMS Status Message ID's.

10050 Cache too small
10061 Download failed (retrying)
10003 Failed (bad environment)
0 No messages have been received
10054 Not enough space in cache
10045 Not enough space in cache
10034 Program cancelled by user
10022 Program completed successfully (reboot pending)
10009 Program completed with success
10008 Program completed with success
10004 Program failed
10007 Program failed
10006 Program failed
10057 Program failed (download failed - content mismatch)
10053 Program failed (download failed)
10058 Program failed (download/location failure)
10051 Program failed (no content)
10071 Program failed (retrying)
10072 Program failed (retrying)
10056 Program failed (retrying)
10070 Program failed (run time exceeded)
10021 Program failed (unexpected restart)
65535 Program received - no further status
10062 Program retrying (download/location failure)
10060 Program retrying (no content)
10005 Program started
10040 Program will not rerun
10055 Retry (Bad environment)
10037 Waiting for another program
10035 Waiting for content
10036 Waiting for user condition

4 Responses to "SMS collection based on advertisement ID or with status"

    1. Hi,
      The article was written in 2009 and it was during SCCM 2007 version.
      Advertisements is only applicable for packages (legacy) and for applications, it is no more advertisements, it is deployment types . Deployment types has its own wmi instances.
      If you are looking for advisement ID for packages ONLY, the collection query is still valid.


  1. Is Advertisement ID the same as Deployment ID? I'm trying to create a collection for a specific package deployment consisting of all deployments that failed with Message ID 10057.


Leave a Reply