Solved

ADS Domain Admin rights etc

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

When ransomware hits your clients, what do you do?

MSPs: Endpoint security isn’t enough to prevent ransomware.
As the impact and severity of crypto ransomware attacks has grown, Webroot fought back, not just by building a next-gen endpoint solution capable of preventing ransomware attacks but also by being a thought leader.

Question has a verified solution.

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

Recently, a new law in my state forced us to get a top-to-bottom analysis of all of our contract client's networks. While we have documentation, it was spotty at best for some - and in any event it needed to be checked against reality. That was m…
The term "Bad USB" is a buzz word that is usually used when talking about attacks on computer systems that involve USB devices. In this article, I will show what possibilities modern windows systems (win8.x and win10) offer to fight these attacks wi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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