Skip to content

Instantly share code, notes, and snippets.

@bobfrankly
Created September 26, 2017 19:34
Show Gist options
  • Save bobfrankly/073c80e9a747916adbcfe7bf743ed49e to your computer and use it in GitHub Desktop.
Save bobfrankly/073c80e9a747916adbcfe7bf743ed49e to your computer and use it in GitHub Desktop.
Hi WEQ
function Get-ADUserWithGroups{
param ($user)
get-aduser $User -Properties memberof | select *, @{name="Groups";expression = {$_.memberof | foreach {([regex]"[^CN=]{3}([^,]*)").match($_).value}}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment