Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ADS Domain Admin rights etc

Posted on 2004-04-12
4
Medium Priority
?
212 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 1000 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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This is a guide to the following problem (not exclusive but here) on Windows: Users need our support and we supporters often use global administrative accounts to do this. Using these accounts safely is a real challenge. Any admin who takes se…
Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

886 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