Shortcut Menu

Skip

Main Navigation

Choose your language

You are here:

ActiveXperts.com > Administration > Scripts > VBScript > List the User Logged on to a Remote Computer

ActiveXperts Network Monitor

Quicklinks


NOTE: ActiveXperts Network Monitor supports SNMP based checks. It ships with free SNMP GET and SNMP TRAP utilities. It also offers many SNMP scripts (PowerShell and VBScript). Download Now »


List the User Logged on to a Remote Computer - VBScript sample

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.


Description

Returns the user name of the user currently logged on to a remote computer. To use this script, replace atl-ws-01 with the name of the remote computer you want to check. Although this script will run on Windows NT 4.0, Windows 98, and Windows 2000, it will not always return information.

Example(s)

strComputer = "atl-ws-o1"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 

Set colComputer = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
 
For Each objComputer in colComputer
    Wscript.Echo "Logged-on user: " & objComputer.UserName
Next