NickolajA / ConfigMgrWebService

48 stars 35 forks source link

GetCMPrimaryUserByDeviceName #26

Closed Tonylinden closed 4 years ago

Tonylinden commented 4 years ago

When using the function GetCMPrimaryUserByDeviceName I get several users back in my result that are not Primary Users, at least not according to the SCCM console.

I am using ConfigMgr WebService 1.8.0

ChadSimmons commented 4 years ago

The actual codes returns a list of UniqueUserName from the WQL

SELECT * FROM SMS_UserMachineRelationship WHERE ResourceName like '" + deviceName + "'"

If you run the same query with PowerShell or whatever how do the results compare to what you see in the ConfigMgr console?

NickolajA commented 4 years ago

This is because in version 1.8.0 (the latest published version) there's no filtering out non-active user/device assignments. This will be fixed in 1.9.0.