Skip to content

Commit f27f24d

Browse files
authored
various updates
1 parent 7c80df6 commit f27f24d

1 file changed

Lines changed: 43 additions & 8 deletions

File tree

RemoveWindowsAi.ps1

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ function Disable-Registry-Keys {
234234
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'DisableClickToDo' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
235235
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'TurnOffSavingSnapshots' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
236236
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'DisableSettingsAgent' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
237+
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'DisableAgentConnectors' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
238+
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'DisableAgentWorkspaces' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
239+
Reg.exe add "$hive\SOFTWARE\Policies\Microsoft\Windows\WindowsAI" /v 'DisableRemoteAgentConnectors' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
237240
Reg.exe add "$hive\SOFTWARE\Microsoft\Windows\Shell\Copilot\BingChat" /v 'IsUserEligible' /t REG_DWORD /d @('0', '1')[$revert] /f *>$null
238241
Reg.exe add "$hive\SOFTWARE\Microsoft\Windows\Shell\Copilot" /v 'IsCopilotAvailable' /t REG_DWORD /d @('0', '1')[$revert] /f *>$null
239242
Reg.exe add "$hive\SOFTWARE\Microsoft\Windows\Shell\Copilot" /v 'CopilotDisabledReason' /t REG_SZ /d @('FeatureIsDisabled', ' ')[$revert] /f *>$null
@@ -324,7 +327,12 @@ function Disable-Registry-Keys {
324327
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint' /v 'DisableGenerativeErase' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
325328
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Paint' /v 'DisableRemoveBackground' /t REG_DWORD /d @('1', '0')[$revert] /f *>$null
326329
#disable ask copilot in context menu
327-
Reg.exe add 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked' /v '{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}' /t REG_SZ /d 'Ask Copilot' /f *>$null
330+
if ($revert) {
331+
Reg.exe delete 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked' /v '{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}' /f *>$null
332+
}
333+
else {
334+
Reg.exe add 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked' /v '{CB3B0003-8088-4EDE-8769-8B354AB2FF8C}' /t REG_SZ /d 'Ask Copilot' /f *>$null
335+
}
328336
#Reg.exe add 'HKLM\SYSTEM\CurrentControlSet\Services\WSAIFabricSvc' /v 'Start' /t REG_DWORD /d @('4', '2')[$revert] /f *>$null
329337
try {
330338
Stop-Service -Name WSAIFabricSvc -Force -ErrorAction Stop
@@ -498,8 +506,17 @@ function Disable-Registry-Keys {
498506
#disable gaming copilot
499507
#found from: https://github.com/meetrevision/playbook/issues/197
500508
#not sure this really does anything in my testing gaming copilot still appears
501-
$command = "reg add 'HKLM\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Microsoft.Xbox.GamingAI.Companion.Host.GamingCompanionHostOptions' /v 'ActivationType' /t REG_DWORD /d 0 /f"
502-
Run-Trusted -command $command -psversion $psversion
509+
if ($revert) {
510+
$command = "reg delete 'HKLM\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Microsoft.Xbox.GamingAI.Companion.Host.GamingCompanionHostOptions' /f"
511+
Run-Trusted -command $command -psversion $psversion
512+
}
513+
else {
514+
$command = "reg add 'HKLM\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Microsoft.Xbox.GamingAI.Companion.Host.GamingCompanionHostOptions' /v 'ActivationType' /t REG_DWORD /d 0 /f;
515+
reg add 'HKLM\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Microsoft.Xbox.GamingAI.Companion.Host.GamingCompanionHostOptions' /v 'Server' /t REG_SZ /d `" `" /f
516+
"
517+
Run-Trusted -command $command -psversion $psversion
518+
}
519+
503520

504521
#remove windows ai dll contracts
505522
$command = "
@@ -564,6 +581,24 @@ function Install-NOAIPackage {
564581
}
565582
}
566583
}
584+
else {
585+
586+
$package = Get-WindowsPackage -Online | Where-Object { $_.PackageName -like '*zoicware*' }
587+
if ($package) {
588+
Write-Status 'Removing Custom Windows Update Package...'
589+
try {
590+
Remove-WindowsPackage -Online -PackageName $package.PackageName -NoRestart -ErrorAction Stop
591+
}
592+
catch {
593+
dism.exe /Online /remove-package /PackageName:$($package.PackageName) /NoRestart
594+
}
595+
596+
}
597+
else {
598+
Write-Status 'Unable to Find Update Package...' -errorOutput $true
599+
}
600+
601+
}
567602

568603
}
569604

@@ -1640,9 +1675,9 @@ function Hide-AI-Components {
16401675

16411676
if ($revert) {
16421677
#if the key is not just hide ai components then just remove it and retain the rest
1643-
if ($existingSettings -ne 'hide:aicomponents;') {
1678+
if ($existingSettings -ne 'hide:aicomponents;appactions;') {
16441679
#in the event that this is just aicomponents but multiple times newkey will just be hide: which is valid
1645-
$newKey = $existingSettings -replace 'aicomponents;', ''
1680+
$newKey = $existingSettings -replace 'aicomponents;appactions;', ''
16461681
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'SettingsPageVisibility' /t REG_SZ /d $newKey /f >$null
16471682
}
16481683
else {
@@ -1654,16 +1689,16 @@ function Hide-AI-Components {
16541689

16551690
if (!($existingSettings.endswith(';'))) {
16561691
#doesnt have trailing ; so need to add it
1657-
$newval = $existingSettings + ';aicomponents;'
1692+
$newval = $existingSettings + ';aicomponents;appactions;'
16581693
}
16591694
else {
1660-
$newval = $existingSettings + 'aicomponents;'
1695+
$newval = $existingSettings + 'aicomponents;appactions;'
16611696
}
16621697

16631698
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'SettingsPageVisibility' /t REG_SZ /d $newval /f >$null
16641699
}
16651700
elseif ($existingSettings -eq $null) {
1666-
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'SettingsPageVisibility' /t REG_SZ /d 'hide:aicomponents;' /f >$null
1701+
Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'SettingsPageVisibility' /t REG_SZ /d 'hide:aicomponents;appactions;' /f >$null
16671702
}
16681703

16691704
}

0 commit comments

Comments
 (0)