Difference between revisions of "How to discover the user logged in a remote workstation"
From Tech-Wiki
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Microsoft]] | [[Category:Microsoft]] | ||
+ | '''[[Microsoft#Misc|Back to Misc]]''' | ||
+ | |||
This VBScript will connect to the remote workstation using WMI and query which user is logged on. | This VBScript will connect to the remote workstation using WMI and query which user is logged on. | ||
Line 15: | Line 17: | ||
Wscript.Echo "Usuário =" &objComputer.UserName | Wscript.Echo "Usuário =" &objComputer.UserName | ||
Next | Next | ||
− |
Latest revision as of 10:20, 24 August 2016
This VBScript will connect to the remote workstation using WMI and query which user is logged on.
strComputer=InputBox("Nome or computer IP address") 'WScript.echo "Hostname: " &strComputer 'WScript.echo "Checking..." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputer = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputer Wscript.Echo "Usuário =" &objComputer.UserName Next