sync: auto-sync from HOWARD-HOME at 2026-07-17 14:35:21
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-07-17 14:35:21
This commit is contained in:
22
clients/cascades-tucson/scripts/applocker-to-gpo.ps1
Normal file
22
clients/cascades-tucson/scripts/applocker-to-gpo.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
Import-Module GroupPolicy
|
||||
$gpoName = 'CSC - Caregiver Device Lockdown'
|
||||
$xmlPath = "\\cascades.local\SYSVOL\cascades.local\scripts\applocker-caregiver.xml"
|
||||
$xml = Get-Content $xmlPath -Raw
|
||||
Set-AppLockerPolicy -XmlPolicy $xmlPath -Ldap "LDAP://$(([ADSI]'').distinguishedName)" -ErrorAction SilentlyContinue
|
||||
# AppLocker GPO needs to be set via registry in the GPO
|
||||
# HKLM\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Appx
|
||||
$gpo = Get-GPO -Name $gpoName
|
||||
$base = 'HKLM\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Appx'
|
||||
Set-GPRegistryValue -Guid $gpo.Id -Key $base -ValueName 'EnforcementMode' -Type String -Value '1' | Out-Null
|
||||
# Parse XML to extract individual rules
|
||||
[xml]$doc = $xml
|
||||
$rules = $doc.AppLockerPolicy.RuleCollection | Where-Object { $_.Type -eq 'Appx' }
|
||||
foreach ($rule in $rules.FilePublisherRule) {
|
||||
$ruleXml = $rule.OuterXml
|
||||
Set-GPRegistryValue -Guid $gpo.Id -Key "$base\$($rule.Id)" -ValueName 'Value' -Type String -Value $ruleXml | Out-Null
|
||||
Write-Output "GPO rule: $($rule.Name)"
|
||||
}
|
||||
Write-Output "AppLocker rules written to GPO: $gpoName"
|
||||
# Enable AppIDSvc via GPO
|
||||
Set-GPRegistryValue -Guid $gpo.Id -Key 'HKLM\SYSTEM\CurrentControlSet\Services\AppIDSvc' -ValueName 'Start' -Type DWord -Value 2 | Out-Null
|
||||
Write-Output "AppIDSvc set to Automatic in GPO"
|
||||
Reference in New Issue
Block a user