Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -AssemblyName System.DirectoryServices.AccountManagement
- $ctype = [System.DirectoryServices.AccountManagement.ContextType]::Domain
- $SSL = [System.DirectoryServices.AccountManagement.ContextOptions]::Negotiate -bor [System.DirectoryServices.AccountManagement.ContextOptions]::SecureSocketLayer
- $ContextType = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext –ArgumentList $ctype,"<domain name>",”<container>”,$SSL
- $group = [System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($ContextType ,"<ad sync source group>")
- $group.GetMembers($true) | select GivenName, UserPrincipalName | Export-Csv -Path C:\TEMP\fb_users.csv
Add Comment
Please, Sign In to add comment