Files
2024-04-10 08:16:49 +02:00

34 lines
802 B
PowerShell

param([string]$InstallDir="C:\Program Files\EgalWare\Maat.Runner");
# funzione verifica servizi
function Confirm-WindowsServiceExists($name)
{
$server="localhost"
if (Get-Service -Name $name -Computername $server -ErrorAction SilentlyContinue -ErrorVariable WindowsServiceExistsError)
{
Write-Host "$name Exists on $server"
return $true
}
if ($WindowsServiceExistsError)
{
Write-Host "$server" $WindowsServiceExistsError[0].exception.message
}
return $false
}
# mi sposto nella directory
CD $InstallDir
# verifico se ci fosse già il servizio e lo disinstallo
if(Confirm-WindowsServiceExists("Maat.Runner"))
{
# stop servizio
./nssm.exe stop Maat.Runner
# elimino servizio installazione
./nssm.exe remove Maat.Runner confirm
}