Add option to run Powershell script via -Verb runAs (i.e. right click, "Run as Administrator".)
We ran into this problem because as a part of our deployment process, we need to stop a service (which isn't a part of our deployment), clear a cached file that the service was holding onto (which IS a part of our deployment), and then restart the service.
Even though the Octopus tentacle has admin rights, and can start/stop a service via the control panel (i.e. log on as the Tentacle user, open the Services cmdlet, and you can start/stop services), to do so via a *Powershell* script requires you to right click on it and selected 'Run as Administrator', or spawn a new shell via the command:
'PS> Start-Process powershell -Verb runAs'
With a bit of mucking about, you use Start-Process in a script that then calls itself in the new shell, as described here (which is what I've done):
So can you add an option to kick off the powershell as administrator? Then I can get rid of the ugly hack :-)