PowerShell Logo Small

Remove-GPLink



This is the built-in help made by Microsoft for the command 'Remove-GPLink', 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.

SYNOPSIS

Removes a GPO link from a site, domain or OU.

SYNTAX


Remove-GPLink [-Domain <String>] [-Server <String>] -Guid <Guid> -Target <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-GPLink [-Name] <String> [-Domain <String>] [-Server <String>] -Target <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-GPLink cmdlet deletes the link between a GPO and a specified site, domain, or OU. This cmdlet does not delete the actual GPO or any other links between the
specified GPO and other sites, domains, or OUs.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?linkid=287727
New-GPLink
Set-GPLink

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>Remove-GPLink -Name "MyGPO" -Target "ou=MyOU,dc=contoso,dc=com"

DisplayName : MyGPO
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : 375865b2-3b5f-480f-8f56-2a994ea6e725
GpoStatus : AllSettingsEnabled
Description :
CreationTime : 2/26/2009 11:28:08 PM
ModificationTime : 3/5/2009 3:36:34 PM
UserVersion : AD Version: 0, SysVol Version: 0
ComputerVersion : AD Version: 1, SysVol Version: 1
WmiFilter :



Description

-----------

This command removes the link between the "MyGPO" GPO and the "MyOU" organizational unit in the contoso.com domain.




-------------------------- EXAMPLE 2 --------------------------

C:\PS>Remove-GPLink -Name "MyGPO" -Target "Default-First-Site-Name"



Description

-----------

This command removes the link between the "MyGPO" GPO and the default site.




-------------------------- EXAMPLE 3 --------------------------

C:\PS>(Get-GPInheritance -Target "ou=myou,dc=contoso,dc=com").GpoLinks | Rem ove-GPLink

DisplayName : TestGPO-3
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : d02126d4-82e8-4e87-b4a0-2d44b6891411
GpoStatus : AllSettingsEnabled
Description :
CreationTime : 2/27/2009 2:59:51 PM
ModificationTime : 3/5/2009 3:36:37 PM
UserVersion : AD Version: 13, SysVol Version: 13
ComputerVersion : AD Version: 0, SysVol Version: 0
WmiFilter :

DisplayName : TestGPO-2
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : 375865b2-3b5f-480f-8f56-2a994ea6e725
GpoStatus : AllSettingsEnabled
Description :
CreationTime : 2/26/2009 11:28:08 PM
ModificationTime : 3/5/2009 3:36:34 PM
UserVersion : AD Version: 0, SysVol Version: 0
ComputerVersion : AD Version: 1, SysVol Version: 1
WmiFilter :



Description

-----------

This command removes the links for all the GPOs that are linked to the "MyOU" organizational unit in the contoso.com domain.

Get-GPInheritance is used to get a Microsoft.GroupPolicy.Som object for the OU. The GpoLinks property of the SOM object contains all the GPO links for GPOs that are linked
to the OU (links that are inherited from higher-level containers are not included). This collection is piped into Remove-GPLink. The GPOs for which links have been removed
are returned.