Skip to content
Snippets Groups Projects
Commit 31dcdb64 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Refuse to update using the Install-Service script.

This has been superseded and is handled much smarter by the updater.

Refers to #13
parent 8304ebbd
No related branches found
No related tags found
No related merge requests found
function Stop-MyService {
Write-Host -NoNewLine "Checking status of $($ServiceName) service: "
try {
$Service = Get-Service $ServiceName -ErrorAction Stop
Write-Host $Service.Status
}
catch {
Write-Host "[FAILED]" -Fore Red
Write-Host "Can't query the service state, stopping."
Exit
}
if ($Service.Status -ne "Stopped") {
Write-Host -NoNewLine "Stopping service $($ServiceName): "
try {
Stop-Service $ServiceName -ErrorAction Stop
Write-Host "[OK]" -Fore Green
}
catch {
Write-Host "[FAILED]" -Fore Red
}
}
}
function Start-MyService {
......@@ -102,15 +80,14 @@ if (Test-Path $LocalConfiguration) {
$ServiceLog = "$($ServiceDir)\$($ServiceName).log"
try {
$Service = Get-Service $ServiceName -ErrorAction Stop
Write-Host "Service $($ServiceName) already installed, updating."
Stop-MyService
Copy-ServiceFiles
}
catch {
Copy-ServiceFiles
Install-Service
$Service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if ($Service) {
Write-Host "Service $($ServiceName) already installed! Please use the" `
"Updater to do service updates. Stopping."
Exit 1
}
Copy-ServiceFiles
Install-Service
Start-MyService
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment