How to Create and Link a Group Policy Object with PowerShell
Applies to: Windows Server 2019, 2022 and 2025 domain environments.
A GPO should have one documented purpose, a defined scope and an owner. Linking it to a test OU allows validation before wider deployment.
Test Group Policy in a controlled OU before production rollout. For managed Windows Server hosting, visit networkmanager.info.
Prerequisites
- Install Group Policy Management tools.
- Choose the target OU.
- Define security filtering and expected settings.
- Create a backup of related policy.
Procedure
Step 1: Load the module
Use GPMC or RSAT.
Import-Module GroupPolicyStep 2: Create the GPO
Use a descriptive name and comment.
New-GPO -Name 'Server Baseline - Audit Policy' -Comment 'Production server audit baseline'Step 3: Link to a test OU
Start with link enabled and enforced false.
New-GPLink -Name 'Server Baseline - Audit Policy' -Target 'OU=Test Servers,DC=corp,DC=example' -LinkEnabled Yes -Enforced NoStep 4: Configure approved settings
Use GPMC or supported registry-policy cmdlets.
Step 5: Pilot
Update policy on test computers and inspect results.
Verification
Confirm the link and resultant policy.
Get-GPO -Name 'Server Baseline - Audit Policy'
Get-GPInheritance -Target 'OU=Test Servers,DC=corp,DC=example'
gpresult /r /scope computerRollback
Disable or remove the link first. Delete the GPO only after confirming it is not linked elsewhere.
Official references
See Netcloud24 Canada for managed Windows VPS and RDS CAL services.