SCCM Report primary device for user

So a customer of mine wanted a report from configuration manager to list primary devices for their users.

Here is the SQL query I used to create this report.

select

 vru.Name0 as [User Name],
 vrs.Name0 as [Computer Name]
 from
 v_UsersPrimaryMachines upm
 left join v_R_User vru
 on upm.UserResourceID = vru.ResourceID
 left join v_R_System vrs
 on upm.MachineID = vrs.ResourceID

 WHERE vru.Name0 != 'Null'

 order by vrs.Name0

Anders Rødland

Anders Rødland started his IT career in 2006. My main focus is MS Configuration Manager and client management, and I currently hold active 15 Microsoft certifications. Certified on Windows Server, Windows Client, SQL, Exchange and System Center Configuration Manager. Anders Rødland also holds an ITIL Foundation certification. This is my private blog and do not represent my employer. I use this to share information that I find useful. Sharing is caring.