OK, I can’t fully decide if this is better asked on ServerFault or SO, but I think this is more of a programming question at heart…(you may disagree)
I’m trying to wrap up all sorts of deployment activities into a single console application, then execute it with appropriate parameters with the TeamCity build Command Line runner. However, attempting to stop/start/install Windows services on a remote machine seems to be a tricky business using ServiceController from a process that can’t run with elevated permissions.
At this point, it might actually be the easiest method to execute Powershell scripts using Invoke-Command on each remote host. (of course, allowing this is a different security hole) than disabling UAC or other options…
Would anyone care to venture an opinion of what methodology would be the best way to proceed?
OK, I created a Powershell-based service controller class to allow an application running without elevated permissions to control remote services.
Here it is:
}
Here’s how you would use it in a console app:
Hopefully someone else finds this useful.