list of Exchange Administrators for an Exchange 2003 Admin Group (AG)

Answered list of Exchange Administrators for an Exchange 2003 Admin Group (AG)

  • Wednesday, July 22, 2009 5:15 PM
     
     
    How can I use vbs to extract a list of groups and users delegated the Exchange Administrator role to an Exchange 2003 Admin Group?  We currently have over 100 delegated groups, and getting the list via a script would make managing it so much better.  I've done lots of AD tasks with vbs, but I need help with ESM tasks.

    I appreciate any help.  Thanks. 

All Replies

  • Thursday, July 23, 2009 3:44 PM
    Moderator
     
     Answered

    Here's a powershell solution:

    $dnc = ([adsi]"").distinguishedName
    $exchange = [adsi]LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,$dnc
    $acl = $exchange.psbase.ObjectSecurity
    $rights = $acl.GetAccessRules($true,$true,[System.Security.Principal.SecurityIdentifier])

    $rights | where {$_.ActiveDirectoryRights.value__ -match '983551|131220|197119'} | foreach {
     
     $obj = $_.IdentityReference.translate([system.security.principal.ntaccount])
     $pso = "" | select User,Role
     $pso.user = $obj

     switch($_.ActiveDirectoryRights.value__)
     {
      983551 { $pso.role="Exchange Full Administrator" }
      131220 { $pso.role="Exchange View Only (Administrator)" }
      197119 { $pso.role="Exchange Administrator" }
     }
     
     $pso
    }


    ## sample output

    User                                   Role
    ----                                     ----
    DOMAIN\Administrator         Exchange Full Administrator
    DOMAIN\Exchange Services Exchange Full Administrator
    DOMAIN\User1                    Exchange View Only (Administrator)
    DOMAIN\ShayL                   Exchange Full Administrator


    Shay Levy [MVP]
    http://blogs.microsoft.co.il/blogs/ScriptFanatic
    PowerShell Toolbar