I found this page about using usernames to build a sccm collection query.


This works great! However, the list I got was in FirstName LastName format and not username. Each FirstName LastName corresponds to the common name in AD. Of course you can take each FirstName LastName and input it into SCCM to find username and create your own username list. However that would take to long.

Could I take a list of FirstName LastName convert it to username list in order to build the collection query based on the username?


  • What version of SCCM are using? – kce Aug 12 '15 at 16:55
  • We are usinf sccm 2012 r2 – Benjamin Jones Aug 12 '15 at 16:56

If your goal is to build a Collection based on specific usernames, I think the easiest and maintainable way to do this is add those users to a security group and create a User Collection.

For Example: We have a User Collection for a specific group of contractors.

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 SMS_R_User.UserGroupName = "DOMAIN\\DEPT-DIV-CONTRACTORS"

As contractors come and go they get added to this security group and the Collection/s updates along the way. We then deploy specific Applications they need to that user Collection. I think in the long run this will be easier and simpler to maintain.

  • Yep. You have to curate that list of names somewhere. An AD security group is the natural place to do that and has the benefit that other applications can use that same curated list. – alx9r Aug 12 '15 at 17:44
  • +1, very maintainable approach, and it helps to have the refresh time in the collection as short as possible so a busy SCCM admin doesn't haven't to go in and update the collection manually everytime a user is added to the security group. – MDMoore313 Aug 13 '15 at 10:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.