dbeckner
Consultant

User Computer Relationship

Jump to solution

In the ConfigMgr tab there are two entries for mapping a user to a computer --

 

- User/Computer Relationship

- User Computer Relationship View

 

How do these two fields differ in execution? Is it necessary to have both configured and is there a benefit to using certain options over others? (Time to map a user to computer, accuracy, etc)

 

Out current configuration is - SCCM Last logon User and v_UserMachineRelationship

0 Kudos
1 Solution
CharlesW
Flexera
Flexera

The user/computer relationship setting determines the query that will be used to sync user computer relationships. Each setting results in a different query, run against the Config Mgr Db, to generate the relationships which are written to the WD_UserComputerMap table. The purpose of the "User Computer Relationship View" setting is to modify the user affinity query query, so that a different view is used.. This different view is only used when you are running a CAS, so the only time that you would modify this setting is if you were using a CAS.. If interested, the following are the default user computer map sync queries which are run for each of the User/computer relationship settings (run against the Config Mgr DB)

--Use SCCM Last Logon user
SELECT DISTINCT vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName,Active0 as Active FROM v_R_System AS vrs
LEFT OUTER JOIN v_R_User AS vru ON vrs.User_Name0 = vru.User_Name0 AND vrs.User_Domain0 = vru.Windows_NT_Domain0

--Use SCCM Primary console usage
select vrs.ResourceID, vrs.Netbios_Name0 AS MachineName, sc.TopConsoleUser0 as UniqueName,Active0 as Active FROM v_R_User AS vru INNER JOIN v_GS_SYSTEM_CONSOLE_USAGE AS sc ON vru.Unique_User_Name0 = sc.TopConsoleUser0
RIGHT OUTER JOIN v_R_System AS vrs ON sc.ResourceID = vrs.ResourceID

--Use AD computer managed by
SELECT DISTINCT vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName,Active0 as Active FROM v_R_User AS vru
RIGHT OUTER JOIN v_R_System AS vrs ON vru.distinguished_Name0 = vrs.managedBy0

--Use User Affinity
select distinct vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName, Active0 as Active FROM v_R_System AS vrs INNER JOIN vUsersPrimaryMachines urm ON vrs.ResourceID = urm.MachineID
INNER JOIN v_R_User AS vru ON urm.UserResourceID = vru.ResourceID

 

If you had changed the "Use Computer Relationship View" setting, then the User Affinity query would be as follows:

select distinct vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName, Active0 as Active FROM v_R_System AS vrs INNER JOIN v_UserMachineRelationship urm ON vrs.ResourceID = urm.MachineID
INNER JOIN v_R_User AS vru ON urm.UserResourceID = vru.ResourceID

View solution in original post

0 Kudos
1 Reply
CharlesW
Flexera
Flexera

The user/computer relationship setting determines the query that will be used to sync user computer relationships. Each setting results in a different query, run against the Config Mgr Db, to generate the relationships which are written to the WD_UserComputerMap table. The purpose of the "User Computer Relationship View" setting is to modify the user affinity query query, so that a different view is used.. This different view is only used when you are running a CAS, so the only time that you would modify this setting is if you were using a CAS.. If interested, the following are the default user computer map sync queries which are run for each of the User/computer relationship settings (run against the Config Mgr DB)

--Use SCCM Last Logon user
SELECT DISTINCT vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName,Active0 as Active FROM v_R_System AS vrs
LEFT OUTER JOIN v_R_User AS vru ON vrs.User_Name0 = vru.User_Name0 AND vrs.User_Domain0 = vru.Windows_NT_Domain0

--Use SCCM Primary console usage
select vrs.ResourceID, vrs.Netbios_Name0 AS MachineName, sc.TopConsoleUser0 as UniqueName,Active0 as Active FROM v_R_User AS vru INNER JOIN v_GS_SYSTEM_CONSOLE_USAGE AS sc ON vru.Unique_User_Name0 = sc.TopConsoleUser0
RIGHT OUTER JOIN v_R_System AS vrs ON sc.ResourceID = vrs.ResourceID

--Use AD computer managed by
SELECT DISTINCT vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName,Active0 as Active FROM v_R_User AS vru
RIGHT OUTER JOIN v_R_System AS vrs ON vru.distinguished_Name0 = vrs.managedBy0

--Use User Affinity
select distinct vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName, Active0 as Active FROM v_R_System AS vrs INNER JOIN vUsersPrimaryMachines urm ON vrs.ResourceID = urm.MachineID
INNER JOIN v_R_User AS vru ON urm.UserResourceID = vru.ResourceID

 

If you had changed the "Use Computer Relationship View" setting, then the User Affinity query would be as follows:

select distinct vrs.ResourceID, vrs.Netbios_Name0 as MachineName, vru.Unique_User_Name0 as UniqueName, Active0 as Active FROM v_R_System AS vrs INNER JOIN v_UserMachineRelationship urm ON vrs.ResourceID = urm.MachineID
INNER JOIN v_R_User AS vru ON urm.UserResourceID = vru.ResourceID

View solution in original post

0 Kudos