- 1 year ago
How can I link (with New-GPLink) a GPO to Organizational Unit that's encapsulated in another Organizational Unit
When using the New-GPLink
cmdlet in PowerShell to link a Group Policy Object (GPO) to an Organizational Unit (OU) that is encapsulated in another OU, you need to provide the full path to the target OU in the Target
parameter. Here's an example:
powershell# Specify the full path to the target OU
$targetOU = "OU=ChildOU,OU=ParentOU,DC=domain,DC=com"
# Get the GPO object
$gpo = Get-GPO -Name "YourGPOName"
# Link the GPO to the target OU
New-GPLink -Name $gpo.DisplayName -Target $targetOU
In the example above, replace OU=ChildOU,OU=ParentOU,DC=domain,DC=com
with the actual full path to your target OU. The -Name
parameter specifies the display name for the GPO link, which can be the same as the GPO display name or a custom name of your choice.
Make sure you have the necessary permissions to perform the operation and ensure that the GPO and the target OU exist in your Active Directory domain.
After executing the above script, the specified GPO will be linked to the target OU within the encapsulating OU structure.