active_directory
This is an old revision of the document!
Table of Contents
Active Directory
Get Group Membership
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
Try this:
Get-ADPrincipalGroupMembership -Identity $env:username | Select name Get-ADPrincipalGroupMembership -Identity 'username' | Select name
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
Get Local Admins
net localgroup administrators
active_directory.1572298210.txt.gz · Last modified: 2019/10/29 22:30 (external edit)