Use the following to query the MECM database to count profiles on devices. Remove the – – comment to focus only on workstation operating systems.
select v_R_System.Name0 as ‘Computer Name’, Count(LocalPath0) as ProfileCount from v_GS_USER_PROFILE
left join v_R_System ON v_R_System.ResourceID = v_GS_USER_PROFILE.ResourceID
where LocalPath0 LIKE ‘%\users\%’
–and v_R_System.Operating_System_Name_and0 LIKE ‘%worksta%’
group by v_R_System.Name0 order by ProfileCount desc