SCCM Collection Query- FullName

active-directoryquerysccmsccm-2012-r2

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

http://jengeek.blogspot.com/2014/07/creating-sccm-collection-from-list-of.html?m=1

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?

Thanks!

Best Answer

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.