Tinus EngOps Wiki

Logo

OpsaC - Operating as PowerShell code

Links

Home

PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View Tinus IT Wiki

View my Photo Website

Group Membership

tags: PowerShell categories: PowerShell-Active-Directory

Table of Contents

GroupMembership

The Get-ADPrincipalGroupMembership cmdlet gets the Active Directory groups that have a specified user, computer, group, or service account as a member. This cmdlet requires a global catalog to perform the group search. If the forest that contains the user, computer, or group does not have a global catalog, the cmdlet returns a non-terminating error.

@{$($env:USERNAME)=(Get-ADPrincipalGroupMembership -Identity $env:USERNAME | Select -ExpandProperty Name)}

Name            Value
----            -----
MyAccount       {Domain Users, Remote Desktop Users}

See also

Get-ADPrincipalGroupMembership on Microsoft Docs.

[ Top ] [ Blog ]