Here is a VB script called WhoIsOn.vbs.
It prompts for the computer name and returns a message box containing the logged on User Name.
ComputerName = InputBox("Enter the name of the computer you wish to query")
who = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set Users = GetObject( who ).InstancesOf ("Win32_ComputerSystem")
for each User in Users
MsgBox "The user name for the specified computer is: " & User.UserName
Next
Note: To avoid accidental running of the script, the scripts on this web server
are stored as *.vb_ file. Clicking on the link will bring up the script in the browser.
From there you can save it for later use, simply by selecting All text in the browser window and
copy/pasting it into your own newly created .vbs script file.
|