PowerShell Logo Small

New-GPLink



This is the built-in help made by Microsoft for the command 'New-GPLink', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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

Links a GPO to a site, domain, or organizational unit (OU).

SYNTAX


New-GPLink [-Domain <String>] [-Enforced <EnforceLink>] [-LinkEnabled <EnableLink>] [-Order <Int32>] [-Server <String>] -Guid <Guid> -Target
<String> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
New-GPLink [-Name] <String> [-Domain <String>] [-Enforced <EnforceLink>] [-LinkEnabled <EnableLink>] [-Order <Int32>] [-Server <String>]
-Target <String> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-GPLink cmdlet links a GPO to a site, domain, or OU. By default, the link is enabled, which means that the settings of the GPO are
applied at the level of the target Active Directory container (site, domain, or OU) according to the rules of inheritance and precedence when
Group Policy is processed.


You can specify the GPO by either its display name or its GUID; or the GPO can be piped into the cmdlet. You specify the site, domain, or OU
to link to by its LDAP distinguished name. You can use other parameters to specify whether the link is enabled, whether the link is enforced,
and the order in which it is applied at the site, domain, or OU.



<

RELATED LINKS

Remove-GPLink
Set-GPLink

REMARKS

<

Examples


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

C:\PS>New-GPO -Name "MyGPO" | New-GPLink -target "ou=MyOU,dc=contoso,dc=com" -LinkEnabled Yes

GpoId : c25daa3e-5d05-43b3-87ca-0a237882fd63
DisplayName : MyGPO
Enabled : True
Enforced : False
Target : OU=MyOU,DC=contoso,DC=com
Order : 1



Description

-----------

This command creates the "MyGPO" GPO in the domain of the user (or, for a startup or shutdown script, the computer) and links it to the "MyOU"
organizational unit in the contoso.com domain. If the domain of the user (or the computer) is different than contoso.com, a trust relationship
must exist between the two domains.

Because New-GPLink can take a GPO as input, you can insert any command that returns a GPO between New-GPO and New-GPLink to configure the GPO.
For example, you can insert Set-GPPermissions commands to set permissions on the GPO, Set-GPRegistryValue commands to configure one or more
registry-based policy settings for the GPO, or Set-GPPrefRegistryValue commands to configure one or more Registry preference items for the GPO.




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

C:\PS>new-gplink -name testgpo -target "dc=contoso,dc=com"

GpoId : d5a3b4e7-e37a-4070-846c-568689eaa838
DisplayName : TestGPO
Enabled : True
Enforced : False
Target : DC=contoso,DC=com
Order : 2



Description

-----------

This command links the "TestGPO" GPO in the domain of the user (or, for a startup or shutdown script, the computer) to the contoso.com domain.
If the domain of the user (or the computer) is different than contoso.com, a trust relationship must exist between the two domains.




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

C:\PS>new-gplink -name testgpo -target "test-site" -enforced yes

GpoId : d5a3b4e7-e37a-4070-846c-568689eaa838
DisplayName : TestGPO
Enabled : True
Enforced : True
Target : CN=test-site,cn=Sites,CN=Configuration,DC=contoso,DC=com
Order : 1



Description

-----------

This command links the "TestGPO" GPO to the "test-site" site and sets the link to enforced.