Solved

ADS Domain Admin rights etc

Posted on 2004-04-12
4
206 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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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