From faab8caadc3ca77eed0c11a141f7d14b36487285 Mon Sep 17 00:00:00 2001 From: zoicware <118035521+zoicware@users.noreply.github.com> Date: Sat, 3 Jan 2026 15:34:15 -0500 Subject: [PATCH] remove/disable ai scheduled tasks improvements --- RemoveWindowsAi.ps1 | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index 9c4f8d0..4e3d992 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -1966,12 +1966,13 @@ Windows Registry Editor Version 5.00 function Remove-Recall-Tasks { - #remove recall tasks - Write-Status -msg 'Removing Recall Scheduled Tasks...' - #believe it or not to disable and remove these you need system priv - #create another sub script for removal - $code = @" -Get-ScheduledTask -TaskPath "*Recall*" | Disable-ScheduledTask -ErrorAction SilentlyContinue + if (!$revert) { + #remove recall tasks + Write-Status -msg 'Removing Recall Scheduled Tasks...' + #believe it or not to disable and remove these you need system priv + #create another sub script for removal + $code = @" +Get-ScheduledTask -TaskPath '*WindowsAI*' -ErrorAction SilentlyContinue | Disable-ScheduledTask -ErrorAction SilentlyContinue Remove-Item "`$env:Systemroot\System32\Tasks\Microsoft\Windows\WindowsAI" -Recurse -Force -ErrorAction SilentlyContinue `$initConfigID = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\WindowsAI\Recall\InitialConfiguration" -Name 'Id' `$policyConfigID = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\WindowsAI\Recall\PolicyConfiguration" -Name 'Id' @@ -1980,14 +1981,31 @@ Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCac Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\`$policyConfigID" -Recurse -Force -ErrorAction SilentlyContinue } Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\WindowsAI" -Force -Recurse -ErrorAction SilentlyContinue +Get-ScheduledTask -TaskName "*Office Actions Server*" -ErrorAction SilentlyContinue | Disable-ScheduledTask -ErrorAction SilentlyContinue + Remove-Item "`$env:Systemroot\System32\Tasks\Microsoft\Office\Office Actions Server" -ErrorAction SilentlyContinue -Force + `$officeConfigID = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Office\Office Actions Server' -Name 'Id' + if (`$officeConfigID) { + Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\`$officeConfigID" -Recurse -Force -ErrorAction SilentlyContinue + } + Remove-Item 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Office\Office Actions Server' -Recurse -Force -ErrorAction SilentlyContinue "@ - $subScript = "$env:TEMP\RemoveRecallTasks.ps1" - New-Item $subScript -Force | Out-Null - Set-Content $subScript -Value $code -Force + $subScript = "$env:TEMP\RemoveRecallTasks.ps1" + New-Item $subScript -Force | Out-Null + Set-Content $subScript -Value $code -Force - $command = "&$subScript" - Run-Trusted -command $command -psversion $psversion - Start-Sleep 1 + $command = "&$subScript" + Run-Trusted -command $command -psversion $psversion + Start-Sleep 1 + + #when just running this option alone the tasks will be remade so we need to at least ensure they are disabled + $command = " + Get-ScheduledTask -TaskName '*Office Actions Server*' -ErrorAction SilentlyContinue | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskPath '*WindowsAI*' | Disable-ScheduledTask -ErrorAction SilentlyContinue + " + Run-Trusted -command $command -psversion $psversion + + } + }