Using enviroment variables in step

Is there a way to access powershell environment variables in a step? For example, if I used a custom installation directory feature would there be a way to access $env:MyVariable which points to a custom path on each machine?

Personally I prefer to manage those variables within Octopus. You can scope a variable to a single machine. While that can lead to a large number of variables at least the configuration is all in one place and you can clearly understand what will happen when you deploy.

However if you’d prefer to use Environment variables they are available to the tentacle. I use $machineName = [Environment]::MachineName in several of my scripts.

The only trick is that you’ll need to ensure that your custom environment variable is available to the service. The easiest way to do that is to define it at the system level, not the user level.