Running a powershell script via octopus deploy to stop a service returns the following error:
“Stop-Service : Service ‘My WinService (WinService)’ cannot be stopped due to the following error: Cannot open WinService service on computer ‘.’.”
The user that the tentacle runs under has administrator privileges and as far as i’m aware, should be able to run the powershell script successfully. The service in question runs under local system and the octopus tentacle runs under a different serviceuser, however i’m not sure that should prevent it from running the script.
I don’t have much more information than this as i’m testing it using the script console. If i run the script manually in powershell:administrator mode, it works as expected so it must be a permissions issue. Is there a way to run the powershell command in administrator mode through powershell?