
find local administrator account
Quote:
> Help,
> I'm trying to write a VBscript that will find all the local administrator
> account on every computer in the domain (of course, computer need to be
> power on). I've found a few hints in the archives but nothing that really
> help me. I'm still trying to find a way to do it...
> I'm looking for some feedback or maybe just being point in the right
> direction.
Hi,
The script below might work. It reveals nested group memberships. You could
skip that by removing the recursive call in the Subroutine.
Option Explicit
Dim objGroup, strComputer
strComputer = "cmptr01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Wscript.Echo "Members of local Administrators group on computer " &
strComputer
Call EnumGroup(objGroup, "")
Sub EnumGroup(objGroup, strOffset)
Dim objMember
For Each objMember In objGroup.Members
Wscript.Echo strOffset & objMember.Name & " (" & objMember.Class & ")"
If objMember.Class = "Group" Then
Call EnumGroup(objMember, strOffSet & "--")
End If
Next
End Sub
I can't get the above to work from one client to another. There may be a
registry setting that will permit this, as others have claimed it can be
done. For me it works from a client to a server only (or on the local
machine).
--
Richard
Microsoft MVP Scripting and ADSI
http://www.rlmueller.net
--