Edit

Share via


Set-GPInheritance

Blocks or unblocks inheritance for a specified ___domain or organizational unit.

Syntax

Set-GPInheritance
   [-Target] <String>
   -IsBlocked <BlockInheritance>
   [-Domain <String>]
   [-Server <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-GPInheritance cmdlet blocks or unblocks inheritance for a specified ___domain or organizational unit (OU).

GPOs are applied according to the Group Policy hierarchy in the following order: local GPO, GPOs linked to the site, GPOs linked to the ___domain, GPOs linked to OUs. By default, an Active Directory container inherits settings from GPOs that are applied at the next higher level in the hierarchy. Blocking inheritance prevents the settings in GPOs that are linked to higher-level sites, domains, or organizational units from being automatically inherited by the specified ___domain or OU, unless the link for a GPO is enforced.

You use the Target parameter to specify the Lightweight Directory Access Protocol (LDAP) distinguished name of the ___domain or OU, and use the IsBlocked parameter to specify whether to block or unblock inheritance.

Examples

Example 1: Block inheritance for a OU in a ___domain

Set-GPInheritance -Target "ou=MyOU,dc=contoso,dc=com" -IsBlocked Yes

Name                  : MyOU
ContainerType         : OU
Path                  : ou=MyOU,dc=contoso,dc=com
GpoInheritanceBlocked : Yes
GpoLinks              : {TestGPO-1, TestGPO-2}
InheritedGpoLinks     : {TestGPO-1, TestGPO-2}

This command blocks inheritance for the OU named MyOU in the contoso.com ___domain. GPOs that are linked to higher-level sites or domains, or to OUs that are parent OUs of the OU named MyOU are not applied, unless their links are enforced, when Group Policy is processed for the OU on the client.

Because inheritance is blocked, only GPOs that are linked directly to the MyOU, and those that are enforced at higher-level containers, appear in the InheritedGpoLinks list.

Example 2: Unblock inheritance for a ___domain

Set-GPInheritance -Target "dc=northwest,dc=contoso,dc=com" -IsBlocked No

This command unblocks inheritance for the northwest.contoso.com ___domain. GPOs linked to higher-level sites or domains are applied to this ___domain when Group Policy is processed on the client.

Example 3: Unblock inheritance for an OU in a ___domain

Set-GPInheritance -Target "ou=MyOU,dc=contoso,dc=com" -IsBlocked No

Name                  : MyOU
ContainerType         : OU
Path                  : ou=MyOU,dc=contoso,dc=com
GpoInheritanceBlocked : No
GpoLinks              : {TestGPO-1, TestGPO-2}
InheritedGpoLinks     : {TestGPO-1, TestGPO-2, Default Domain Policy}

This command unblocks inheritance for the OU named MyOU in the contoso.com ___domain. GPOs that are linked to higher-level sites or domains, or to OUs that are parent OUs of the OU named MyOU, are applied when Group Policy is processed for the OU on the client.

Because inheritance is not blocked, GPOs that are inherited from higher-level containers appear in the InheritedGpoLinks list (together with GPOs that are linked directly to the OU). For instance, the Default Domain Policy GPO is linked at the ___domain level.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Domain

Specifies the ___domain for this cmdlet. You must specify the fully qualified ___domain name (FQDN) of the ___domain.

For the Set-GPInheritance cmdlet, this is typically the ___domain of the Active Directory container (___domain or OU) for which you want to block or unblock inheritance. If the ___domain for the cmdlet is different than the ___domain of the container, a trust must exist between the two domains.

If you do not specify the Domain parameter, the ___domain of the user that is running the current session is used. If the cmdlet is being run from a computer startup or shutdown script, the ___domain of the computer is used. For more information, see the Notes section in the full Help.

If you specify a ___domain that is different from the ___domain of the user that is running the current session (or, for a startup or shutdown script, the computer), a trust must exist between that ___domain and the ___domain of the user or the computer.

You can also refer to the Domain parameter by its built-in alias, DomainName. For more information, see about_Aliases.

Type:String
Aliases:DomainName
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IsBlocked

Indicates whether to block inheritance for the ___domain or OU. You must specify Yes or No.

The following values are permitted for this object type.

Type:BlockInheritance
Accepted values:No, Yes
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Server

Specifies the name of the ___domain controller that this cmdlet contacts to complete the operation. You can specify either the fully qualified ___domain name (FQDN) or the host name.

If you do not specify the name by using the Server parameter, the primary ___domain controller (PDC) emulator is contacted.

You can also refer to the Server parameter by its built-in alias, DC.

Type:String
Aliases:DC
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Target

Specifies the ___domain or the OU for which to block or unblock inheritance by its LDAP distinguished name. For instance, the MyOU organizational unit in the contoso.com ___domain is specified as ou=MyOU,dc=contoso,dc=com.

You can also refer to the Target parameter by its built-in alias, Path.

Type:String
Aliases:Path
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.GroupPolicy.Som

This cmdlet takes an object that represents a ___domain or an OU as input.

Outputs

Microsoft.GroupPolicy.Som

This cmdlet returns an object that represents the ___domain or OU after the operation is applied. The properties of this object that are displayed by default describe the Group Policy inheritance information for the ___domain or OU. The GpoInheritanceBlocked property indicates whether inheritance is blocked.

Notes

  • GPO links that are enforced cannot be blocked. This cmdlet should be used sparingly. Casual use of this cmdlet can complicate troubleshooting.

    You can use the Domain parameter to explicitly specify the ___domain for this cmdlet.

    If you do not explicitly specify the ___domain, the cmdlet uses a default ___domain. The default ___domain is the ___domain that is used to access network resources by the security context under which the current session is running. This ___domain is typically the ___domain of the user that is running the session. For instance, the ___domain of the user who started the session by opening Windows PowerShell from the Program Files menu, or the ___domain of a user that is specified in a runas command. However, computer startup and shutdown scripts run under the context of the LocalSystem account. The LocalSystem account is a built-in local account, and it accesses network resources under the context of the computer account. Therefore, when this cmdlet is run from a startup or shutdown script, the default ___domain is the ___domain to which the computer is joined.