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.

Use New-Service for Windows service creation

rcourtmanb6f0d74c55fd
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 8cbbff3041..cd2ba42042 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -314,18 +314,18 @@ if (-not [string]::IsNullOrWhiteSpace($AgentId)) { $ServiceArgs += @("--agent-id
$BinPath = "`"$DestPath`" $($ServiceArgs -join ' ')"
-# Create Service with error handling
-$scOutput = sc.exe create $AgentName binPath= "$BinPath" start= auto displayname= "Pulse Unified Agent" 2>&1
-if ($LASTEXITCODE -ne 0) {
- Show-Error "Failed to create service '$AgentName'.`nsc.exe output: $scOutput"
+# Create Service using New-Service (more reliable than sc.exe create)
+try {
+ New-Service -Name $AgentName `
+ -BinaryPathName $BinPath `
+ -DisplayName "Pulse Unified Agent" `
+ -Description "Pulse Unified Agent for Host and Docker monitoring" `
+ -StartupType Automatic | Out-Null
+ Write-Host "Service created successfully" -ForegroundColor Green
+} catch {
+ Show-Error "Failed to create service '$AgentName'.`nError: $_"
Exit 1
}
-Write-Host "Service created successfully" -ForegroundColor Green
-
-$scOutput = sc.exe description $AgentName "Pulse Unified Agent for Host and Docker monitoring" 2>&1
-if ($LASTEXITCODE -ne 0) {
- Write-Host "Warning: Failed to set service description: $scOutput" -ForegroundColor Yellow
-}
$scOutput = sc.exe failure $AgentName reset= 86400 actions= restart/5000/restart/5000/restart/5000 2>&1
if ($LASTEXITCODE -ne 0) {