- $serviceName ="XYY.WindowsService.MQ";
function installService
{
Write-Warning "安装服务";
.\XYY.WindowsService.MQ install;
}
function uninstallService
{
Write-Warning "卸载服务";
.\XYY.WindowsService.MQ uninstall;
}
Get-Service $serviceName -ErrorAction SilentlyContinue;
if($?)
{
Write-Output ($serviceName)"服务存在";
uninstallService;
installService;
}
else
{
Write-Output ($serviceName)"服务不存在";
installService;
}
|