Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: trywaredkPosted on 2004-04-12 at 13:56:59ID: 10808497
On Error Resume Next
me" inGroup" lok"
ipt.Shell" ) ng.FileSys temObject" ) sFileName)
sComputer)
DomainInpu t)
----"
uter.Name)
---------- ---------- ---------- ---------- ---------- ---------- ---------- "
dim oFso, oFile, sFileName
Dim oDomain, wshShell
Dim sProgramNavn, sMsgBoxTitle, sDomainInput, sLocalAdminGroup, sDomain, sNotepadWindowName
Dim bStatus
sMsgBoxTitle="Collect members of local admin group."
sDomainInput="YourDomainNa
sLocalAdminGroup = "ADMINISTRATORER"
sProgramNavn="EnumLocalAdm
sFileName="C:\TEMP\" & sProgramNavn & ".txt"
sNotepadWindowName="Notesb
Set WshShell = WScript.CreateObject("WScr
Set oFso=CreateObject("Scripti
Set oFile=oFso.CreateTextFile(
sLocalAdminGroup = uCase(sLocalAdminGroup)
Function WriteComputer(sDomainName,
Dim colGroups, oGroup, oUser
Dim sFound, sTab
sTab = vbTab
If Len(sDomainName & "/" & sComputer) <= 15 Then sTab = vbTab & vbTab
Set colGroups = GetObject("WinNT://" & sComputer & "")
colGroups.Filter = Array("group")
For Each oGroup In colGroups
If uCase(oGroup.Name) = sLocalAdminGroup Then
For Each oUser in oGroup.Members
sFound = sDomainName & "/" & sComputer & sTab & oGroup.Name & sTab & oUser.Name
oFile.WriteLine sFound
Next
End if
Next
Set colGroups=Nothing
Set oGroup=Nothing
Set oUser=Nothing
End Function
'********************* MAIN PROGRAM **********************
sDomain=InputBox("Input DomainName",sMsgBoxTitle,s
If sDomain="" Then
MsgBox "Domainname is missing - try again."
wScript.Quit
End If
Set oDomain = GetObject("WinNT://" & sDomain)
oDomain.Filter = Array("computer")
MsgBox "Press OK, and wait a minute for each online computer ..."
oFile.WriteLine "Collect members of local admin group for all online computers in domain " & sDomain & vbCrLf & vbCrLf
oFile.WriteLine "COMPUTERNAME:" & vbTab & vbTab & "MEMBERS OF LOCAL ADMIN GROUP:"
oFile.WriteLine "-------------" & vbTab & vbTab & "-------------------------
For Each Computer in oDomain
bStatus = WriteComputer(sDomain,Comp
Next
oFile.WriteLine vbCrlf & vbCrlf
oFile.WriteLine "-------------------------
oFile.WriteLine sProgramNavn & ".cis" & vbCrLf & Now & vbCrLf & vbCrLF
wScript.sleep 1000
WshShell.Run ("%windir%\notepad " & sFileName)
wScript.sleep 1000
WshShell.AppActivate sNotepadWindowName
Set oDomain=Nothing
Set wshShell=Nothing
Set oFso=Nothing
Wscript.Quit
Many Regards
Jorgen Malmgren
IT-Supervisor
Denmark
:o) Your brain is like a parachute. It works best when it's open