Skip to content

Instantly share code, notes, and snippets.

@sub314xxl
Created March 14, 2018 14:17
Show Gist options
  • Save sub314xxl/6c543fbfc0266e0548675568f9c57aee to your computer and use it in GitHub Desktop.
Save sub314xxl/6c543fbfc0266e0548675568f9c57aee to your computer and use it in GitHub Desktop.
CheckADGroupMembership.ps1
# Run from current user session
(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf | Select-String GROUP_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment