Windows Scripting Host - VBS
Posted on 2004-04-08
Using WSH - VBS, I am trying to list all computers attached to a domain as well as the username logged on to that computer.
I have been successful in listing the computers:
Dim objDomain, i, objComputer
i = 1
'Create handle to ADSI object for specified domain
Set objDomain = GetObject("WinNT://" & sDomName)
'Remove all entities except computers
objDomain.filter = Array("Computer")
'Populate global array with computer names
For Each objComputer In objDomain
DomainComputers(i) = objComputer.Name
set objDomain = nothing
set objComputer = nothing
BUT - how do I list the user who is logged onto that machine and onto the domain (if one is indeed logged on).
In other words, I want to make a snapshot report of a domain, all of its computers and who is logged in thru each computer.