chore: fix GPO baseline
This commit is contained in:
@ -93,7 +93,8 @@ $gpos = @(
|
|||||||
)
|
)
|
||||||
|
|
||||||
foreach ($gpo in $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-GPO -Name $gpo.Name | Out-Null
|
||||||
New-GPLink -Name $gpo.Name -Target $gpo.Target | Out-Null
|
New-GPLink -Name $gpo.Name -Target $gpo.Target | Out-Null
|
||||||
Write-Host "Created and linked GPO '${gpo.Name}'." -ForegroundColor Cyan
|
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
|
# Example: set secure screensaver in Security Baseline GPO
|
||||||
Set-GPRegistryValue -Name "Security Baseline" `
|
Set-GPRegistryValue -Name "Security Baseline" `
|
||||||
-Key "HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `
|
-Key "HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `
|
||||||
|
Reference in New Issue
Block a user