Hello, could you please help with the powershell script to link the GPO to multiple OUs with OUs inout file

jay k 21 Reputation points
2021-03-31T07:28:24.433+00:00

Looking for powershell script to link the GPO to multiple OUs

Windows for business Windows Server User experience PowerShell
Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-04-01T03:24:04.64+00:00

    Hi,

    The New-GPLink cmdlet links a GPO to an OU like below

     $OUs = "OU=ou1,DC=contoso,DC=com", "OU=ou2,DC=contoso,DC=com"  
     $OUs | ForEach-Object {  
        New-GPLink -Name "MyGPO" -Target $_  
     }  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.