SCCM Configmgr 2012 Collection for computers with Primary User (UDA) is NULL

If you are using User Device Affinity--associating a user with one or more specified devices  for application deployment to make sure the application install on all devices that are associated with that user,it is necessary to identify the computers which do not have primary User Defined.More about User Define Affinity http://technet.microsoft.com/en-us/library/gg699365.aspx.

Create collection using below WQL query for list of computers with Primary Device is NULL.(Make sure you limit the collection to computers with Client installed and Active) else you will get all computers who do not have sccm client installed .

WQL query uses wmi class (SMS_UserMachineRelationship) which store the information only about UDA relationship. Usermachinerelationship will not have any entries for computers do not have UDA relationship.

so I use subselected query using not in function.Get list of computers for which UDA relationship is not null and compare them with v_r_system active clients.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ResourceId not in (select resourceid from SMS_UserMachineRelationship where UniqueUserName is not null)

Updated: There was a question on myitform recently ,asking for Users (collection or SQL Report) without Device affinity set.

For User collection :

Select * From SMS_R_User where UniqueUserName not in (Select UniqueUserName from SMS_UserMachineRelationship)

For SQL Report:

select
vru.ResourceID,
vru.Full_User_Name0 as [Full Name]
from v_R_User vru
where vru.ResourceID not in (select vru.ResourceID
from v_UsersPrimaryMachines upm
left join v_R_User vru on upm.UserResourceID = vru.ResourceID
where vru.Name0 IS NOT NULL
)

Thanks to Ryan and John.

Hope it helps.

3 Responses to "SCCM Configmgr 2012 Collection for computers with Primary User (UDA) is NULL"

  1. Hi,

    Is it possible to restrict UDA to certain machine types i.e. only set a primary device if the device name begins with a certain prefix?

    Thank you.

    Reply
    1. You can create new client agent settings with the required UDA options and apply this to collection .This collection will have all device names that begins with certain prefix .

      Reply
  2. Hi,

    thank you a lot for this piece of info. I'll add my WQL query if you have different Full Names from your Login-Names. It's much easier to read the Machine User Affinity this way.

    Select Rel.UniqueUserName, Usr.UniqueUserName, Usr.FullUserName, Rel.ResourceName, Sys.Name from SMS_UserMachineRelationship AS Rel, SMS_R_SYSTEM AS Sys, SMS_R_User as Usr where Sys.ResourceID = Rel.ResourceID AND Rel.UniqueUserName = Usr.UniqueUserName AND Rel.IsActive is not null

    Thanks again.
    sanso

    Reply

Leave a Reply