This is the built-in help made by Microsoft for the command 'Get-GPPermission', in PowerShell version 5 - as retrieved from
Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Gets the permission level for one or more security principals on a specified GPO.
Get-GPPermission [-All] [-DomainName <String>] [-Server <String>] [-TargetName <String>] [-TargetType <PermissionTrusteeType>] -Guid <Guid> [<CommonParameters>]
Get-GPPermission [-Name] <String> [-All] [-DomainName <String>] [-Server <String>] [-TargetName <String>] [-TargetType <PermissionTrusteeType>] [<CommonParameters>]
Gets the permission level for one or more security principals on the specified GPO. You can use the TargetName and TargetType parameters to specify a user, security group,
or computer for which to retrieve the permission level. You can use the All parameter to retrieve the permission level for each security principal (user, security group, or
computer) that has permissions on the GPO. You can specify the GPO by its display name or by its GUID.
<
Online Version: http://go.microsoft.com/fwlink/?linkid=287717
Set-GPPermission
<
-------------------------- EXAMPLE 1 --------------------------
C:\PS>Get-GPPermission -Name TestGpo -TargetName "Domain Users" -TargetType Group
Trustee : Domain Users
TrusteeType : Group
PermissionLevel : GpoRead
Inherited : False
Description
-----------
This command gets the permission level for the "Domain Users" group on the GPO named TestGpo.
-------------------------- EXAMPLE 2 --------------------------
C:\PS>Get-GPPermission -Domain sales.contoso.com -Server DC1 -GUID fa4a9473-6e2a-4b87-ab78-175e68d97bde -TargetName "Domain Admins" -TargetType Group
Description
-----------
This command gets the permission level for the "Domain Admins" group on the GPO with the GUID fa4a9473-6e2a-4b78-175e68d97bde in the Sales.Contoso.com domain. The
DC1.sales.contoso.com domain controller is contacted to complete the operation.
If the domain of the user that is running the session (or, for startup and shutdown scripts, the computer) is different from the sales.contoso.com domain, a trust must exist
between the two domains, or the command fails.
-------------------------- EXAMPLE 3 --------------------------
C:\PS>Get-GPPermission -Name TestGPO -All
Trustee : Authenticated Users
TrusteeType : WellKnownGroup
Permission : GpoApply
Inherited : False
Trustee : Domain Admins
TrusteeType : Group
Permission : GpoEditDeleteModifySecurity
Inherited : False
Trustee : Enterprise Admins
TrusteeType : Group
Permission : GpoEditDeleteModifySecurity
Inherited : False
Trustee : ENTERPRISE DOMAIN CONTROLLERS
TrusteeType : WellKnownGroup
Permission : GpoRead
Inherited : False
Trustee : SYSTEM
TrusteeType : WellKnownGroup
Permission : GpoEditDeleteModifySecurity
Inherited : False
Description
-----------
This command gets the permission level for each security principal that has permissions on the GPO.
-------------------------- EXAMPLE 4 --------------------------
C:\PS>Get-GPO -All | foreach-object { if($_ | Get-GPPermission -TargetName "contoso\Domain Admins" -TargetType Group -ErrorAction SilentlyContinue) {$_.DisplayName}}
Default Domain Policy
TestGPO-1
TestGPO-2 Default Domain Controllers Policy
Internet Security
TestGPO
Description
-----------
This command lists the display name of each GPO (in the domain) on which the specified security principal has permissions.
First, Get-GPO is used to retrieve all the GPOs in the domain (Get-GPO -All). Then, the collection is piped into the foreach-object command. As each GPO is evaluated, it is
piped into Get-GPPermissions. If a permission level is returned, the DisplayName property of the GPO is printed ($_.DisplayName).
Note: The ErrorAction parameter is set to SilentlyContinue for Get-GPPermissions. This is because a non-terminating error occurs if the specified security principal does not
have permissions on the GPO. Specifying the ErrorAction as SilentlyContinue prevents the error messages from being printed for GPOS on which the security principal does not
have permissions. For more information about the ErrorAction parameter, see about_CommonParameters.