net user username /domain
To get just the top level groups:
Get-ADPrincipalGroupMembership -Identity $env:username | Select name, GroupCategory, GroupScope, distinguishedName Get-ADPrincipalGroupMembership -Identity 'username' | Select name, GroupCategory, GroupScope, distinguishedName
To get all groups:
whoami /groups whoami /groups | out-file group.txt
This generates a whole heap of crap - the security groups are at the end. This also seems to recurse down the groups or something - it lists more groups than the other options.
gpresult /R
May need to install a module:
Install-WindowsFeature RSAT-AD-PowerShell
Also, try this:
get-aduser $env:username -Properties memberof | select -expand memberof get-aduser 'username' -Properties memberof | select -expand memberof
Or, a module-free version:
(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf
net localgroup administrators
Get-ADGroupMember "X3 NZ Provoke Developers" -Recursive