Monday, January 24, 2011

Joining two or more collections into a new collection

Use the below code to create a new SCCM 'Collection' using the members of other one or more other collections.

- Create new collection
- Use a 'Query' to define the Membership Rules
- Use system resources
- Use the below SQL code to define the members.

Change the XXXXXXX to the Collection ID you want.

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_XXXXXXX) or SMS_R_System.ResourceId in (select ResourceId from SMS_CM_RES_COLL_XXXXXXX)

Boom! your new collection is now populated with the members of other collections.

No comments :

Post a comment