I was asked how to create a user collection based on multiple AD groups in a comment on my blog post on how to create User Collection based on AD User Group. I thought I’d quickly share out the query code needed to achieve this.

select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User WHERE ResourceID IN (SELECT ResourceID FROM SMS_R_User where SMS_R_User.SecurityGroupName ="domain\\group1") AND ResourceID IN (SELECT ResourceID FROM SMS_R_User where SMS_R_User.SecurityGroupName = "domain\\group2")

‘Nuff said!