bcowdery / octopus-scripts

Powershell deployment scripts for windows services, creating message queues and other common tasks for Octopus deployments.
MIT License
19 stars 4 forks source link

TopShelf service does not install #1

Closed osudude closed 9 years ago

osudude commented 10 years ago

For some reason the Octopus script would not install our TopShelf service. We had to change it like so:

try and install / update the service by name

$service = Get-Service $ServiceName -ErrorAction SilentlyContinue

$fullPath = Resolve-Path $ServiceExecutable

if (! $service) { Write-Host "The service will be installed"

$args = " install -username:$SvcUid -password:$SvcPwd --autostart" 
Write-Host $args
$cmd = "$fullPath"
Write-Host $cmd

$command = 'cmd.exe /C "' + $fullPath + '" ' + $args
Write-Host $command
Invoke-Expression -Command:$command

}

bcowdery commented 9 years ago

Fixed in pull request #2