Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix silent sc.exe delete failures in install.ps1

rcourtmandb8790a463ed
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 97a6ac95aa..e5b99cf34d 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -120,7 +120,14 @@ if ($Uninstall) {
if (Get-Service $AgentName -ErrorAction SilentlyContinue) {
Stop-Service $AgentName -Force -ErrorAction SilentlyContinue
- sc.exe delete $AgentName | Out-Null
+ $scOutput = sc.exe delete $AgentName 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "Warning: Failed to delete service: $scOutput" -ForegroundColor Yellow
+ } else {
+ Write-Host "Service deleted successfully" -ForegroundColor Green
+ }
+ } else {
+ Write-Host "Service '$AgentName' not found (already removed)" -ForegroundColor Yellow
}
Remove-Item "$InstallDir\$BinaryName" -Force -ErrorAction SilentlyContinue
@@ -236,7 +243,10 @@ Write-Host "Checking for legacy agents..." -ForegroundColor Cyan
if (Get-Service "PulseHostAgent" -ErrorAction SilentlyContinue) {
Write-Host "Removing legacy PulseHostAgent..." -ForegroundColor Yellow
Stop-Service "PulseHostAgent" -Force -ErrorAction SilentlyContinue
- sc.exe delete "PulseHostAgent" | Out-Null
+ $scOutput = sc.exe delete "PulseHostAgent" 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "Warning: Failed to delete PulseHostAgent service: $scOutput" -ForegroundColor Yellow
+ }
Remove-Item "C:\Program Files\Pulse\pulse-host-agent.exe" -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
}
@@ -244,7 +254,10 @@ if (Get-Service "PulseHostAgent" -ErrorAction SilentlyContinue) {
if (Get-Service "PulseDockerAgent" -ErrorAction SilentlyContinue) {
Write-Host "Removing legacy PulseDockerAgent..." -ForegroundColor Yellow
Stop-Service "PulseDockerAgent" -Force -ErrorAction SilentlyContinue
- sc.exe delete "PulseDockerAgent" | Out-Null
+ $scOutput = sc.exe delete "PulseDockerAgent" 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "Warning: Failed to delete PulseDockerAgent service: $scOutput" -ForegroundColor Yellow
+ }
Remove-Item "C:\Program Files\Pulse\pulse-docker-agent.exe" -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
}
@@ -254,8 +267,12 @@ Write-Host "Installing binary..." -ForegroundColor Cyan
# Stop existing service if running
if (Get-Service $AgentName -ErrorAction SilentlyContinue) {
+ Write-Host "Removing existing $AgentName service..." -ForegroundColor Yellow
Stop-Service $AgentName -Force -ErrorAction SilentlyContinue
- sc.exe delete $AgentName | Out-Null
+ $scOutput = sc.exe delete $AgentName 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "Warning: Failed to delete existing service: $scOutput" -ForegroundColor Yellow
+ }
Start-Sleep -Seconds 2
}