' LoggedOn.vbs ' ' List User Logged On To A Remote Computer ' ' Written by Cheyenne Harden ' ' Hey, who is logged on to the accounting computer on the third floor? ' Dunno?!!? Now you don't have to wonder. This script will display the currently ' logged on user on a remote computer. ' ' Obtained From: http://lazynetworkadmin.com/content/view/34/6/ ' Obtained On: January 12, 2007 On error resume next strComputer = InputBox("Type in the name of the computer you want to query.") If strComputer > "" Then Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputer = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputer Wscript.Echo objComputer.UserName Next Else Wscript.Quit End If Wscript.Quit