In tip 1211 » Who is logged on locally, we used Windows commands to determine
who was logged onto the console of the specified computer.
Here is a VB script that I named 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
0 comments
Hide comments