How to discover the user logged in a remote workstation

From Tech-Wiki
Revision as of 15:20, 14 July 2016 by Fabricio.Lima (Talk | contribs) (Created page with "Category:Microsoft This VBScript will connect to the remote workstation using WMI and query which user is logged on. <nowiki> strComputer=InputBox("Nome or computer IP...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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
 <nowiki>