Obtaining the logged in user from a remote machine

  • Thread starter Thread starter Sam Evans
  • Start date Start date
S

Sam Evans

All,

I am trying to figure out how I can obtain the userid of an individual
who's logged into a PC by using a remote call. What I'm ultimately
attempting to do is something along the lines of 'nbtstat' where it
shows the domain and the userid who is logged in.

Does anyone have any C# code they can point me to, or perhaps some MSDN
information?

Thank you,
Sam
 
Dale,

Thanks for the reply. I have finally got around to implementing the WMI
example you posted, however, my understanding is that WMI only works
if the user account you are using to enumerate has appropriate access on
the remote machine.

Do you know of any code examples or can explain how I could do an
nbtstat type of function from within C#? Nbtstat is independant of any
user privileges but can pull out the logged in user.

Thanks,
Sam
 
Sam Evans said:
Dale,

Thanks for the reply. I have finally got around to implementing the WMI
example you posted, however, my understanding is that WMI only works if
the user account you are using to enumerate has appropriate access on the
remote machine.

Do you know of any code examples or can explain how I could do an nbtstat
type of function from within C#? Nbtstat is independant of any user
privileges but can pull out the logged in user.

Thanks,
Sam

Not sure what you mean here, Nbtstat does not show Logged in users, it's
simply inquiring the remote Netbios registered machine name tables. So what
you see are the cached names of the domain and machine as broadcasted when
the network stack boots, but not the Login user name.

Willy.
 
Back
Top