/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I am looking to write a script to check who is logged on, on a list of remote machines, any pointers would be greatly appreciated
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Try this

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")



For Each objItem in colItems

WScript.Echo strComputer & objItem.UserName
Next
Answered 04/18/2005 by: UcMerrill
Senior Yellow Belt

Please log in to comment
0
Thanks
Answered 04/18/2005 by: Naffcat
Senior Purple Belt

Please log in to comment
0
Please excuse my ignorance, but how would I use the above script with a list of assets I want to query?

Thanks
Answered 11/22/2005 by: glwday
Orange Belt

Please log in to comment
0
If it's a small list or a one time job you could do a array.
If it's a big list or you want to reuse the script I would have it read a text file.

Something like

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fin = Fso.OpenTextFile("C:\SvrList.txt", 1)
Do While Fin.AtEndOfStream <> True
strComputer = Fin.readline
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems
WScript.Echo strComputer & objItem.UserName
Next
Loop
Fin.close
Answered 12/13/2005 by: Byoung4now
Senior Yellow Belt

Please log in to comment