Files

22 lines
628 B
PowerShell

#Requires -RunAsAdministrator
param(
[string]$ProjectRoot = "",
[string]$NssmPath = "nssm.exe"
)
$ErrorActionPreference = "Stop"
if ([string]::IsNullOrWhiteSpace($ProjectRoot)) {
$ProjectRoot = if ($env:GYXX_PROJECT_ROOT) {
$env:GYXX_PROJECT_ROOT
} else {
(Resolve-Path (Join-Path $PSScriptRoot "..\..\..\..\..\..")).Path
}
}
$uninstaller = Join-Path $ProjectRoot "deploy\windows-service\uninstall.ps1"
if (-not (Test-Path -LiteralPath $uninstaller -PathType Leaf)) {
throw "Server scheduler uninstaller is missing: $uninstaller"
}
& $uninstaller -NssmPath $NssmPath
exit $LASTEXITCODE