Obtaining the logged in user from a remote machine

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
 
S

Sam Evans

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
 
W

Willy Denoyette [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top