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.
Copy and paste the following text into notepad and save it al LoggedOn.vbs
----------COPY EVERYTHING BELOW THIS LINE----------
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
----------COPY EVERYTHING ABOVE THIS LINE----------
PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR NOTEPAD!!!
*Make sure you are an administrator to run this.
This information is provided "AS IS" with no warranties expressed or implied.
Advertisements
|