Query computer to which users logged onto

Hi,

I'm looking for a query I can target to a usercollection. Goal is to find the computers these users logged on to in order to know what computer(s) they own.

May 20th, 2015 11:28am

Does the built in query - systems by last logged on user not suffice?
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2015 11:42am

You could create a device collection and use the "Username" property of the SMS_G_Computer_System view to filter on a user ID...

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 inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.UserName = "CONTOSO\\johndoe"

May 20th, 2015 11:46am

I think I wronlgy expressed myself. I have a USER collection which has 20 users in it. Of them I would like to know to which computer they logon to. Not the other way around (don't have the computers, I'm actually looking for them).
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2015 12:17pm

Ok. That WQL statement above will simply return all of the devices which a given user has logged onto.  It's only one user at a time though.
May 20th, 2015 12:59pm

If you're comfortable with SQL, this will work:

select

u.Full_User_Name0, u.Unique_User_Name0, s.Name0 from v_fullcollectionmembership fcm

join v_R_User u on fcm.ResourceID = u.ResourceID

join v_R_System s on s.User_Name0 = u.User_Name0


where

fcm.CollectionID = '<Your Collection ID>'

Free Windows Admin Tool Kit Click here and download it now
May 20th, 2015 2:54pm

Thanks but I'm not. I really need to make a collection of pc's based upon users in that other collection.
May 20th, 2015 3:01pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics