mirror of
https://github.com/zoicware/RemoveWindowsAI.git
synced 2025-12-17 15:16:27 +01:00
fix #66 when aarsvc is already removed
This commit is contained in:
@@ -360,7 +360,13 @@ function Disable-Registry-Keys {
|
|||||||
}
|
}
|
||||||
if (!$revert) {
|
if (!$revert) {
|
||||||
#remove conversational agent service (used to be used for cortana, prob going to be updated for new ai agents and copilot)
|
#remove conversational agent service (used to be used for cortana, prob going to be updated for new ai agents and copilot)
|
||||||
$aarSVCName = (Get-Service -ErrorAction SilentlyContinue | Where-Object { $_.name -like '*aarsvc*' }).Name
|
try {
|
||||||
|
$aarSVCName = (Get-Service -ErrorAction SilentlyContinue | Where-Object { $_.name -like '*aarsvc*' }).Name
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
#aarsvc already removed
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($aarSVCName) {
|
if ($aarSVCName) {
|
||||||
if ($backup) {
|
if ($backup) {
|
||||||
@@ -380,7 +386,13 @@ function Disable-Registry-Keys {
|
|||||||
Stop-Service -Name $aarSVCName -Force -ErrorAction Stop
|
Stop-Service -Name $aarSVCName -Force -ErrorAction Stop
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
#ignore error when svc is already removed
|
try {
|
||||||
|
Stop-Service -Name AarSvc -Force -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
#neither are running
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.exe delete AarSvc *>$null
|
sc.exe delete AarSvc *>$null
|
||||||
|
|||||||
Reference in New Issue
Block a user