Add Cmdlet to uninstall PowerShell service

Fixes #32
This commit is contained in:
Christian Stein 2019-12-06 19:33:14 +01:00
parent c1710062ae
commit c7c2ef8c22

View file

@ -0,0 +1,19 @@
function Uninstall-IcingaFrameworkService()
{
Stop-IcingaService 'icingapowershell';
Start-Sleep -Seconds 1;
$ServiceCreation = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'delete icingapowershell';
switch ($ServiceCreation.ExitCode) {
0 {
Write-Host 'Icinga PowerShell Service was successfully removed';
}
1060 {
Write-Host 'The Icinga PowerShell Service is not installed';
}
Default {
throw ([string]::Format('Failed to install Icinga PowerShell Service: {0}{1}', $ServiceCreation.Message, $ServiceCreation.Error));
}
}
}