mirror of
https://github.com/zoicware/RemoveWindowsAI.git
synced 2026-01-10 17:54:50 +01:00
remove/disable ai scheduled tasks improvements
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user