# RegisterStartup.ps1 # Run this once as Administrator to install FingerprintCompareServer as a Windows Service. # It will start automatically with Windows and run silently in the background. $exePath = Join-Path $PSScriptRoot "FingerprintCompareServer.exe" $svcName = "FingerprintCompareServer" $svcDisplay = "Fingerprint Compare Server" if (-not (Test-Path $exePath)) { Write-Error "Could not find $exePath — publish the project first (use the SelfContained profile)." exit 1 } # Remove any existing installation $existing = Get-Service -Name $svcName -ErrorAction SilentlyContinue if ($existing) { Stop-Service -Name $svcName -Force -ErrorAction SilentlyContinue sc.exe delete $svcName | Out-Null Start-Sleep -Seconds 1 } # Install and start the service New-Service -Name $svcName ` -DisplayName $svcDisplay ` -BinaryPathName $exePath ` -StartupType Automatic ` -Description "Fingerprint comparison server — listens on http://localhost:5050/verify" Start-Service -Name $svcName Write-Host "" Write-Host "Service '$svcName' installed and started." -ForegroundColor Green Write-Host "It will start automatically on every reboot." Write-Host "" Write-Host "To check status: Get-Service -Name '$svcName'" Write-Host "To stop: Stop-Service -Name '$svcName'" Write-Host "To start: Start-Service -Name '$svcName'" Write-Host "To uninstall: sc.exe delete '$svcName'"