I have a couple of servers that have been configured (for one reason or another) with a custom PowerShell profile script for the Octopus Tentacle service account. Unfortunately, the profile script has an error when it loads, which is causing custom PowerShell deployment steps on that server to fail.
I can’t change the profile script or remove it from the Octopus Tentacle service account as they require changes that are outside of my jurisdiction on the relevant servers.
Is there a way to run custom PowerShell deployment steps with the “-NoProfile” switch to prevent the profile loading?
Thanks for reaching out! Your question generated a good discussion among the team, and we ended up deciding to add a way to tell Octopus to run scripts using
-NoProfile. You can follow the progress of this enhancement on this github issue: https://github.com/OctopusDeploy/Issues/issues/2545
We’ll most likely end up adding a variable called
Octopus.Action.PowerShell.ExecuteWithoutProfile that when set to
true will tell Octopus to execute scripts in that Tentacle without loading a profile. The good thing about this approach is that users will be able to scope this variable to different machines/environments/roles and run scripts with profile and some machines, and without it on others.
At the moment there’s no workaround for this unfortunately. You’re gonna have to wait until we implement this feature in Octopus.