Skip to content

Instantly share code, notes, and snippets.

@belotn
Last active December 11, 2015 21:38
Show Gist options
  • Save belotn/4663666 to your computer and use it in GitHub Desktop.
Save belotn/4663666 to your computer and use it in GitHub Desktop.
Récupérer rapidement les privilèges Citrix d'un compte ActiveDirectory
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = '(&(objectCategory=User)(sAMAccountName=MyUser))'
$Searcher.SearchRoot = 'LDAP://dc=ds,dc=example,dc=com'
$user = [adsi]$Searcher.FindAll()[0].Path
$groups = @($user.memberOf | % { ([adsi]"LDAP://$_").Cn })
$admin = @(Get-xaadministrator | select AdministratorName | % { $_.AdministratorNAme.Split()[0] })
$mygroup = compare-object $groups $admin -ExcludeDifferent -IncludeEqual -Passthru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment