From c68ea2dcd3d51e17f48a9fc5ce2abe4dc44841ef Mon Sep 17 00:00:00 2001 From: Matthew McKinnon Date: Thu, 31 Jul 2025 10:48:25 +1000 Subject: [PATCH] chore: fix GPO baseline --- Setup-AD-PostReboot.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Setup-AD-PostReboot.ps1 b/Setup-AD-PostReboot.ps1 index b736352..b014eca 100644 --- a/Setup-AD-PostReboot.ps1 +++ b/Setup-AD-PostReboot.ps1 @@ -93,7 +93,8 @@ $gpos = @( ) foreach ($gpo in $gpos) { - if (-not (Get-GPO -Name $gpo.Name -ErrorAction SilentlyContinue)) { + $existingGPO = Get-GPO -Name $gpo.Name -ErrorAction SilentlyContinue + if (-not $existingGPO) { New-GPO -Name $gpo.Name | Out-Null New-GPLink -Name $gpo.Name -Target $gpo.Target | Out-Null Write-Host "Created and linked GPO '${gpo.Name}'." -ForegroundColor Cyan @@ -102,6 +103,7 @@ foreach ($gpo in $gpos) { } } + # Example: set secure screensaver in Security Baseline GPO Set-GPRegistryValue -Name "Security Baseline" ` -Key "HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `