Subscribe to Windows IT Pro
December 08, 2003 12:00 AM

Find the Name of the Computer a User Is Logged On To

Windows IT Pro
InstantDoc ID #40879
Rating: (2)
Downloads
40879.zip

As a member of a technical support team, I've found that determining the name of the computer a user is logged on to is often helpful in handling the user's Help desk request. Knowing the user's computer name lets me use a remote administration tool such as Computer Management, Event Viewer, or a registry editor to connect to the computer and troubleshoot the problem. I wrote the script ObtainCompNames.vbs, which Web Listing 1 (http://www.winnetmag.com/windowsscripting, InstantDoc ID 40879) shows to obtain users' computer names from the network.

ObtainCompNames.vbs uses netsh.exe, a utility that lets you retrieve WINS name table information from remote systems and perform WINS database administration from the command line. You can find netsh.exe in your Windows OS's Administration Tools Pack. In the script, netsh.exe accesses your company's WINS database and retrieves the IP address associated with the username you enter.

For ObtainCompNames.vbs to work in your environment, you need to install Windows Script Host (WSH) 5.6 and the latest version of the Administration Tools Pack for your OS. WSH 5.6 gives you access to the WScript.Shell object's Exec method, which you need to capture and manipulate the netsh.exe utility's output.

To use ObtainCompNames.vbs, you must have read access to your company's WINS server. You also need to know the WINS server's name, which you must specify in the script. Listing 2 shows the code that you need to customize. In this code, replace WinsServerName with the name of your WINS server.

Related Content:

ARTICLE TOOLS

Comments
  • scott
    5 years ago
    Nov 12, 2007

    Whoops, there is also a direct link to this tool:

    http://www.motivatesystems.com/User_Locator.asp

  • scott
    5 years ago
    Nov 12, 2007

    I've also found it very useful to find out where users are logged onto. Especially when users leave you a message, then by the time you call back they are out to lunch or away from their desk. Often, if you can determine which computer they are logged onto or use, you can finish the task before the user gets back.

    This is a good method, but my favority tool by far is called User Locator from Motivate Systems. You can download it for free on their website (http://www.motivatesystems.com).

    No only does it list computer(s) the user is logged onto very very fast but it also bind common tools to one click button. This tools has saved me loads of time, and I recommend it to everyone. It's the bomb!

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.