Created
February 4, 2020 19:07
-
-
Save happiness801/5ad735877bc4e621bc61e84124c5fc89 to your computer and use it in GitHub Desktop.
Gets list of groups that a user belongs to
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$requestuser=$env:username) | |
( | |
New-Object System.DirectoryServices.DirectorySearcher( | |
"(&(objectCategory=User)(samAccountName=$requestuser))" | |
) | |
).FindOne().GetDirectoryEntry().memberOf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment