header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

AD Group Inconsistencies
Last Post 06 Aug 2008 04:53 PM by bsonposh. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MCKUser is Offline
New Member
New Member
Posts:2

--
31 Jul 2008 12:00 PM  

After a Auth restore of a OU that was deleted it looks like we have some inconsistent group membership.  How can I use powershell to query each DC, over 50, and compare each group and its members and report and differences. There are a few hundred groups under the OU.

bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
05 Aug 2008 03:47 PM  
I believe I answered this on ActiveDir, but just in case... here is script to do what you want

$domain = [system.directoryservices.activedirectory.domain]::GetCurrentDomain()
$domainde = $domain.GetDirectoryEntry()
$dcs = $domain.FindDomainControllers()
$DCGroups = @{}
foreach($dc in $dcs)
{
    Write-Host " + Processing DC $($dc.Name)"

    $myGroupObjs = @()

    $searcher = $dc.GetDirectorySearcher()
    $searcher.PageSize = 1000
    $searcher.Filter = "objectcategory=group"
    foreach($result in $searcher.FindAll())
    {
        $MyGroupObj = "" | Select-Object GroupName,GroupMembers

        $myGroup = $result.GetDirectoryEntry()
        Write-host "   - Processing Group $($myGroup.Name[ 0 ])"
        $members = $myGroup.psbase.invokeGet('member')
        $MyGroupObj.GroupName = $myGroup.Name[ 0 ]
        $MyGroupObj.GroupMembers = $members

        $MyGroupObjs += $MyGroupObj
    }
    $DCGroups.Add($dc.Name,$MyGroupObjs)
}
$DCGroups
MCKUser is Offline
New Member
New Member
Posts:2

--
06 Aug 2008 04:16 PM  
Yes you did answer this on ActiveDir. Thanks again for all your help. Did you ever figure out how to compare the output to find the inconsistencies of users.
bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
06 Aug 2008 04:53 PM  
To be honest... I thought you got what you wanted and I haven't looked in to it.

I will take a look
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer