Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help

Status
Not open for further replies.

Goose241

Technical User
Feb 1, 2004
27
US
I have been using the follow script to try and figure out who is logged on to a particular system on my network. All I have to do is change RemoteComputer to whatever remote system I want to find out who is logged into. But for some reason it only shows null for any users other than Administrators. Any suggestions as to what I am doing wrong would be appreciated.

strComputer = "RemoteComputer"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next
 
You need administrative access to connect to another computer using WMI. Assuming your real script does not stop on errors, that would explain you getting a null value returned if the account running the script does not have administrative access to the computer you are checking.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top