Friday, September 25, 2015

List the User Logged on to a Remote Computer

Script to list the User Logged on to a Remote Computer


strComputer = "abc"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 

Set colComputer = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")

ForEach objComputer in colComputer
    Wscript.Echo "Users: " & objComputer.UserName
Next

No comments:

Post a Comment

Windows Server 2016 Key Features and License Prospects

If you are planning to move to Windows 2016 and looking for benefits, I have listed down below : Why Windows Server 2016? ·     ...