Solved

ADS Domain Admin rights etc

Posted on 2004-04-12
4
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
trywaredk earned 250 total points
ID: 10808497
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
ID: 10808566
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
No security measures warrant 100% as a "silver bullet". The truth is we also cannot assume anything but a defensive and vigilance posture. Adopt no trust by default and reveal in assumption. Only assume anonymity or invisibility in the reverse. Safe…

740 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