Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

Determine the Machines Users Are Logged On To
 

Many times, I need to find out the computers users are currently logged on to. Thus, I wrote FindLogon.vbs, which locates the machine a user is logged on to by looking at the open sessions on the user's home server and determining which computers those sessions-originate from.

Listing 1 shows an excerpt from FindLogon.vbs. You can download the entire script from the Windows Scripting Solutions Web site. Go to http://www.windowsitpro.com/windowsscripting, enter 48796 in the InstantDoc ID text box, then click the 48796.zip hotlink. I wrote this script for machines running Windows XP. To launch the script, use the command

CScript FindLogon.vbs domain\nt_id 

where domain is the name of the user's domain and nt_id is the user's logon name.

FindLogon.vbs assumes that the home directory field in the user's domain account properties isn't empty. This field contains the name of the user's home server, which is needed to access that server's sessions. When a user accesses resources on a server, an active session is established-between the user's computer and that server. Sessions are managed by the file service. Thus, to obtain session objects, FindLogon.vbs binds to the LanmanServer service, as Listing 1 shows. The script then iterates through each session object to obtain the name of the computer involved in that session.







Reader Comments

I see the echo username & " logins to : " but nothing else shows

Bartolini -November 12, 2007
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement