Solved

ADS Domain Admin rights etc

Posted on 2004-04-12
4
203 Views
Last Modified: 2013-12-04
Can I run a report or command to see who has administrative privilages on our domain.
0
Comment
Question by:NaveedAnwar
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
trywaredk earned 250 total points
Comment Utility
On Error Resume Next

dim oFso, oFile, sFileName

Dim oDomain, wshShell
Dim sProgramNavn, sMsgBoxTitle, sDomainInput, sLocalAdminGroup, sDomain, sNotepadWindowName
Dim bStatus

      sMsgBoxTitle="Collect members of local admin group."
      sDomainInput="YourDomainName"
      sLocalAdminGroup = "ADMINISTRATORER"                  
      sProgramNavn="EnumLocalAdminGroup"
      sFileName="C:\TEMP\" & sProgramNavn & ".txt"
      sNotepadWindowName="Notesblok"
      
      Set WshShell = WScript.CreateObject("WScript.Shell")
      Set oFso=CreateObject("Scripting.FileSystemObject")
      Set oFile=oFso.CreateTextFile(sFileName)

      sLocalAdminGroup = uCase(sLocalAdminGroup)
      
      
      
Function WriteComputer(sDomainName,sComputer)
  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,sDomainInput)

      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,Computer.Name)
      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
0
 
LVL 12

Expert Comment

by:trywaredk
Comment Utility
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: btan
The intent is not to repeat what many has know about Ransomware but more to join its dots of what is it, who are the victims, why it exists, when and how we respond on infection. Lastly, sum up in a glance to share such information with more to help…
OfficeMate Freezes on login or does not load after login credentials are input.
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now