Discover user name given IP address or NetBIOS name

  • Thread starter Thread starter rdonnici
  • Start date Start date
R

rdonnici

Hi all,

Is there any way to, given an IP address(or NETBIOS machinename - I can
convert from one to other) from my network, and assuming that everyone
needs to log on a NT/2K/Windows Server 2003 Server, to discover the
user name for the user logged on that machine? The final result
desired is something like a table, with pairs [IP(or NB machnename),
username] at the moment the program is run.

Any ideas? I have hunted high and low on the newsgroups and have not
found any kind of solution.

Thanks in advance,

Rafael
 
Rafael,

Nope. The thing here is that there could be no one logged onto the
machine, or there could be multiple users logged onto the machine in
different sessions. You really have no way of knowing.

From what I can tell, the only way to get this information would be to
install an agent on each machine. The only way I can think of to do this
would be to have terminal services installed on the machine and then use the
API for terminal services to see who is logged into that machine.

Hope this helps.
 
To do it in VBScript with WMI, use
http://www.microsoft.com/technet/scriptcenter/scripts/desktop/logon/dmlgvb02.mspx

After looking at that, look at the WMI and System.Management classes in the
..Net framework.

To get the user, make sure you set a reference to System.Management.dll

There's a pretty good article at
http://www.csharphelp.com/archives3/archive584.html. Be sure to look for
part II of the article at
http://www.csharphelp.com/archives3/archive585.html for more specific
details.

Hope this helps,

DalePres
MCAD, MCDBA, MCSE
 
If someone is logged on the Explorer.exe process will be running. Query
the remote computer using WMI for that process object. The process
owner will indicate who is logged on. You can even programatically
determine how long that user has been logged in. The defaultuser name
value in the registry can be queried to determine the previously
logged-in user if the Explorer.exe process is not running.

I can supply code if needed.

Jim Evans
 
Back
Top