From 1fd7a1150353b6074cd6a642a333035ca7a19a31 Mon Sep 17 00:00:00 2001 From: nicholxs <41819863+nichxlxs@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:49:19 +1000 Subject: [PATCH 1/2] Check if service exists before attempting to remove --- Powershell/InstallHuntress.powershellv2.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Powershell/InstallHuntress.powershellv2.ps1 b/Powershell/InstallHuntress.powershellv2.ps1 index 84ede1f..04568b8 100644 --- a/Powershell/InstallHuntress.powershellv2.ps1 +++ b/Powershell/InstallHuntress.powershellv2.ps1 @@ -722,7 +722,7 @@ function uninstallHuntress { # if Huntress services still exist, then delete $services = @("HuntressRio", "HuntressAgent", "HuntressUpdater", "Huntmon") foreach ($service in $services) { - if ( $service ) { + if (Confirm-ServiceExists $service) { LogMessage "Service $($service) detected post uninstall, attempting to remove" c:\Windows\System32\sc.exe STOP $service c:\Windows\System32\sc.exe DELETE $service From 30ec20ee13e387ff5e9baf4d125bdbc7b42263b5 Mon Sep 17 00:00:00 2001 From: nicholxs <41819863+nichxlxs@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:50:07 +1000 Subject: [PATCH 2/2] Check if service exists before attempting to remove --- Datto-RMM/scripts/InstallHuntress.dattormm.comstore.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Datto-RMM/scripts/InstallHuntress.dattormm.comstore.ps1 b/Datto-RMM/scripts/InstallHuntress.dattormm.comstore.ps1 index 328260a..bd8f187 100644 --- a/Datto-RMM/scripts/InstallHuntress.dattormm.comstore.ps1 +++ b/Datto-RMM/scripts/InstallHuntress.dattormm.comstore.ps1 @@ -726,7 +726,7 @@ function uninstallHuntress { # if Huntress services still exist, then delete $services = @("HuntressRio", "HuntressAgent", "HuntressUpdater", "Huntmon") foreach ($service in $services) { - if ( $service ) { + if (Confirm-ServiceExists $service) { LogMessage "Service $($service) detected post uninstall, attempting to remove" c:\Windows\System32\sc.exe STOP $service c:\Windows\System32\sc.exe DELETE $service