SMSSCCM collection 排除另一個collection

經常有遇到希望建立排除已安裝某些軟體的用戶端,例如我們需要抓出未安裝IE8用戶端,針對collection A: All system,另外建立一個collection B 內容包含所有安裝過IE8用戶端,在建立一個collection C透過A-B=C 方式列出未安裝IE8的用戶端

Collection A: all systems
Collection B: Client with “IE8” installed

Collection C: C=A-B
We could create the collection C with the following WQL query

**************
select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client from SMS_R_System where SMS_R_System.ResourceId in (select ResourceID from SMS_CM_RES_COLL_XXXXXXXX) and SMS_R_System.ResourceId not in (select ResourceID from SMS_CM_RES_COLL_YYYYYYYY)
**************

Here, the  SMS_CM_RES_COLL_XXXXXXXX is the source collection A and the SMS_CM_RES_COLL_YYYYYYYY is the exclusion collection B
Note: we could get the collection ID from the SMS admin console-> collections->Detail pane

The “All Systems” collection ID:SMS0001 and the “IE8” collection ID:001000AB