0

Is it possible to get the computer name for a person that is found through Active Directory?

I am currently getting the person via DirectorySearcher object, and from there can get the user's SID, but i don't know where to look next in order to find the actual computer name that is assigned to that SID or person?

Or maybe there is an easier way to get this information from Active Directory?

MaxOvrdrv
  • 1,780
  • 17
  • 32
  • 3
    Computers are not assigned to users as far as I know. – rory.ap Mar 19 '15 at 15:50
  • depending on your organization, they actually are. At least on the business side... for example, i, Maxovrdr, have been assigned 2 computers, NHQ-12345 and NHQ-12346 ... so basically there's no way to get that information out of ADS directly? – MaxOvrdrv Mar 19 '15 at 15:53
  • 1
    Where does that assignment exist, i.e. if I were looking at it in AD Users & Computers? – rory.ap Mar 19 '15 at 15:54
  • that's what i'm trying to figure out! ;) or if it does at all... – MaxOvrdrv Mar 19 '15 at 15:54
  • 1
    That's what I meant by my comment. AD does not store an association between users and computers. – rory.ap Mar 19 '15 at 15:57
  • then please post as answer since you actually gave the answer in a comment before anyone else. I will accept it, and query my local Network Admin folks to find out how i can get to that information instead of through ADS. – MaxOvrdrv Mar 19 '15 at 15:58
  • 1
    Go ahead and accept the other answer if you want. – rory.ap Mar 19 '15 at 15:59

1 Answers1

1

There is no association of computers to users in default AD - so there is no way to get such information.

You may find last/currently logged on set of machines for a user (also I don't think this is available in AD, see How to find what user last logged onto a given computer through Active Directory in C#? for some starting points) or maybe you add custom information that gives that association in AD (Retrieving custom Active Directory properties of users).

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179