Friday, February 11, 2011

Determine logged on user on a remote Windows machine

Is there a way to determine who is logged on to a particular (remote) machine given the IP address (or the workstation name) of the machine?

  • The machines in question are on an Active Directory Domain
  • The user running the script probably won't have any special rights on either their local or the remote machine
  • Operating system is Windows XP

Any programming language is fine but ideally

  • VBScript (yeah I know)
  • C#
  • Java
  • DOS Batch file
  • Difficult to do depending on the permissioning on the machine. One way is to query WMI on the remote machine and check the owner of the explorer.exe process.

    From EBGreen
  • PSloggedon from SysInternals will provide this from a batch file, however the user would require admin access on the remote machine. I doubt you can get this information without Administrator access.

    Mark Roddy : +1 for any solution involving SysInternals apps. Also, since there's an ActiveDirectory domain, you can allow this app to run for a group of people that you want to run the script (assuming you have rights to make those types of changes on the domain controller).
    David Hayes : Sweet thanks, looks like PSloggedOn is what I need I'll test it with a non-admin user!
    David Hayes : Seems to work with non-admin users (at least in our domain)
    From benPearce
  • You don't need admin access. Just use net apis. ask on news://194.177.96.26/comp.os.ms-windows.programmer.win32 where it's a FAQ

0 comments:

Post a Comment