fix #66 when aarsvc is already removed

This commit is contained in:
zoicware
2025-12-09 19:27:56 -05:00
committed by GitHub
parent 6aa32df3ad
commit db06701f1f

View File

@@ -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