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" `