add other ai policies to disable in region policy set

This commit is contained in:
zoicware
2025-11-02 20:38:13 -05:00
committed by GitHub
parent 4be53a9388
commit e1a1d28d12

View File

@@ -513,9 +513,22 @@ function Disable-Copilot-Policies {
foreach ($policies in $copilotPolicies) { foreach ($policies in $copilotPolicies) {
$policies.defaultState = @('disabled', 'enabled')[$revert] $policies.defaultState = @('disabled', 'enabled')[$revert]
} }
$recallPolicies = $jsonContent.policies | Where-Object { $_.'$comment' -like '*A9*' -or $_.'$comment' -like '*Manage Recall*' -or $_.'$comment' -like '*Settings Agent*' }
foreach ($recallPolicy in $recallPolicies) {
if ($recallPolicy.'$comment' -like '*A9*') {
$recallPolicy.defaultState = @('enabled', 'disabled')[$revert]
}
elseif ($recallPolicy.'$comment' -like '*Manage Recall*') {
$recallPolicy.defaultState = @('disabled', 'enabled')[$revert]
}
elseif ($recallPolicy.'$comment' -like '*Settings Agent*') {
$recallPolicy.defaultState = @('enabled', 'disabled')[$revert]
}
}
$newJSONContent = $jsonContent | ConvertTo-Json -Depth 100 $newJSONContent = $jsonContent | ConvertTo-Json -Depth 100
Set-Content $JSONPath -Value $newJSONContent -Force Set-Content $JSONPath -Value $newJSONContent -Force
Write-Status -msg "$($copilotPolicies.count) CoPilot Policies $(@('Disabled','Enabled')[$revert])" $total = ($copilotPolicies.count) + ($recallPolicies.count)
Write-Status -msg "$total CoPilot Policies $(@('Disabled','Enabled')[$revert])"
} }
catch { catch {
Write-Status -msg 'CoPilot Not Found in IntegratedServicesRegionPolicySet' -errorOutput $true Write-Status -msg 'CoPilot Not Found in IntegratedServicesRegionPolicySet' -errorOutput $true