Hey we have been using Octopusdeploy for ½ a year now and so far all have been working nice and easy!
But we got 2 new servers running Windows server 2012, and i have some trouble to get it to work.
The same service is deployed to other servers running Windows server 2003 (SP2) and 2008 where it Works fine.
The problem:
We have a Deploy.ps1 (base on the example found in the documentation) last thing it will do is:
Start-Service $ServiceName
On WS2012 i get an error (our service is called E247.CMS.Encode):
Service ‘E247.CMS.Encode (E247.CMS.Encode)’ cannot be started due to the following error: Cannot open E247.CMS.Encode service on computer ‘.’.
If i logon to the server and start powershell and run Start-Service E247.CMS.Encode i get the same error. If i start powershell elevated it works fine. After some reading it seems something have changes on WS2012 and the UAC will kick in if you try to start a service
One suggestion i found was trying to elevate the start-service command.
Start-Process “$psHome\powershell.exe” -Verb Runas -ArgumentList ‘-command “Start-Service $ServiceName”’ | Write-Host
but the tentacle just hang with that command…
Of cause one solution is to disable the UAC but i don’t like that and should be a last resort.
Another solution (this i have not tried yet) is to use the scheduler, so you should be able to add a task to the scheduler that will start the service, and should be able to Schedule it to run elevated.
But this is a bit complicated solution imho, so before i start trying all this i was hoping to find a more easy solution here
Btw i’m not (yet) a guru in powershell so it might just be lack of knollage
/T