
#Function Compare-Group {
#[Commandletbinding ()]
Param (
        [Parameter (Mandatory = $True,
        Valuefrompipeline = $True,
        ValueFromPipelineByPropertyname = $true)] [string[]]$user
        

)

Import-Module ActiveDirectory 

        $user =  "alb100" |

#Get Groups return by GC
        Write-host "$Item._Username" -ForegroundColor Green
        $CDSGroup = ($user | Get-ADPrincipalGroupMembership -server "bhm1dc02.controlsdata.com").name
        
        $AECGroup = ($user | Get-ADPrincipalGroupMembership -server "AEC01A-DC03.aecuk.aec.local").name
   
     
     ForEach ($Item in $user) {
      
    compare-object -ReferenceObject $CDSGroup -DifferenceObject $AECGroup | where {$_.sideindicator -eq "=>" }
    

    }


#Compare Groups and export result
    #compare-object -ReferenceObject $CDSGroup -DifferenceObject $AECGroup | export-csv c:\scripts\output\Groupdif.csv


#}
 



