ConfigMgr : Collection of Devices Based on Primary User Group Membership

In the spirit of ‘eating your own dog food’ I often test new deployments on my team’s client devices – to make this easier I’ve created a WQL, query-based collection of all of their client devices based upon Primary User’s group membership. The nice thing about this group is that any new devices we’re testing will automatically be added.

{code lang:text showtitle:false lines:false hidden:false}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
JOIN SMS_UserMachineRelationship ON SMS_R_System.Name=SMS_UserMachineRelationship.ResourceName
JOIN SMS_R_User ON SMS_UserMachineRelationship.UniqueUserName=SMS_R_User.UniqueUserName
WHERE SMS_UserMachineRelationship.Types=1 AND SMS_R_User.UserGroupName=”DOMAIN\\GroupName” AND SMS_R_System.OperatingSystemNameandVersion like “Microsoft Windows NT Workstation%”{/code}

Leave a Reply

Your email address will not be published. Required fields are marked *