Powershell step has variables empty

Hi, I am testing a powershell script because I would like to execute some files in the package location so I am trying to output some values with the following script:

Write-Output "Deploy Information"
Write-Output "- > Deploying application: " $OctopusParameters[‘Clientele_Name’]
Write-Output "- > Version: " $OctopusParameters[‘Clientele_Version’]
Write-Output "- > Package version: " $OctopusParameters[‘Octopus.Action[Deploy Setup].Package.NuGetPackageVersion’]

Write-Output "Deploy Location"
Write-Output "- > Path: " $OctopusParameters[‘Octopus.Tentacle.CurrentDeployment.PackageFilePath’]
Write-Output "- > Machine: " $OctopusParameters[‘Octopus.Tentacle.Agent.InstanceName’]

But the output of the last part is empty, so Octopus doesn’t tell me the Installation Path and the Agent Instance Name

Deploy Information

  • Deploying application:

  • Version:

  • Package version:
    Deploy Location

  • Path:

  • Machine:


Hi, are you using powershell 4.0 on the tentacle agent?

I have exactly the same problem and I suspect it’s due to powershell 4.


Hi Raffaeu,

I think your PowerShell script is in a PowerShell script step (which unfortunately doesn’t have access to these variables). For the script to work, you’ll need to put it inside of your package, as a Deploy.ps1 or PostDeploy.ps1 script for example. You can learn more about embedding scripts here:


Hi Paul and thank you for your reply.
Yes you are right, I have a sub-step Powershell after the package is downloaded and unpacked on the Client side (Tentacle)

What I am going to do is to iterate through your dictionary from the Nuget script and for the main Powershell step and see what I have on each one.

I will be back and update this thread as soon as I have the results.

So, I have made few tests.

  • Execute the script as a separate Powershell step
  • Execute the script within the package (pre, during and post)

This is the powershell script

Write-Output "Deploy Location"
Write-Output "- > Path: " $OctopusParameters['Octopus.Tentacle.CurrentDeployment.PackageFilePath']
Write-Output "- > Installation: " $OctopusParameters['OctopusOriginalPackageDirectoryPath']
Write-Output "- > Notes: " $OctopusParameters['Octopus.Release.Notes']
Write-Output "- > Machine: " $OctopusParameters['Octopus.Machine.Name'] $OctopusParameters['Octopus.Machine.Id']


The Single Powershell step (not child) doesn’t display all the info

[code]Tentacle script execution
Deploy Information

  • Deploying application:

  • Version:

  • Package version:
    Deploy Location

  • Path:

  • Machine: [/code]

But if I execute the script within the package (Pre, Post or deployment.ps1) all the variables are properly populated.
At this point I would suggest to mention this in the documentation cause when you create a powershell script, it seems obvious that the variables will be there

Thanks for the update. We’ve made changes to support this fully in the upcoming 2.4 release: https://github.com/OctopusDeploy/Issues/issues/739


I look at the issue on GITHUB and did not see anyone working on this. Do we have a tentative date for a solution…

I know a specific date cannot be given but I’ve got a temporary solution in place (using the Octopus variables only) and if the solution is going to take awhile then I will have to change to putting the code in a Deploy.ps1 script and have it executed from there…


Thanks for getting in touch! I am a bit confused about your response. The GitHub issue linked was indeed completed and released.
Could you please provide specific details on your issue, what you are seeing or expect to see, a deployment log, and what version of Octopus and Tentacle you have installed.
There was also a blog post that explains what was added and updated and how to use the variables:



We are currently running Octopus and Octopus tentacle and we are still experiencing the problem with getting variables populated. Currently I am working on trying to writing a Powershell script that will eventually become the post deployment script for deploying things to Azure. I am trying to see if it possible to use the variables within the Variable set that we’ve set up instead of duplicating them in a text or another powershell file within the VS studio project. Here is the sample of that code

Import-Module Azure
Import-AzurePublishSettingsFile -PublishSettingsFile “E:\Sites\octopus.nuget.server\Powershell\DRN_Azure_Production_credentials.publishsettings”

Select-AzureSubscription ‘DRN (Initial Subscription)’

Select-AzureSubscription 'DRN (Initial Subscription)'
Write-Host ‘About to request for getting service results’

$serviceResult = Test-AzureName -Service 'drntestsvc-attribute-calculate’
Write-Host $serviceResult

Write-Host ‘Looking for and display Octopus variables’
$drnLocalDNS = $OctopusParameters[‘Octopus.Acquire.MaxParallelism’]
$sktContent = $OctopusParameters[“SKTContext”]

Write-Host "DNS-Local is: $drnLocalDNS"
Write-Host “SKTContent is: $sktContent”

you see i am trying to get a environment variable in one case and a variable we created in another…in both cases I do not get anything back. I am running this script threw the run-script portion of the Octopus Tentacle. This is also happen withn I have a script with a deployment step/process.

Any help is appreciated


Where are you setting SKTContext?
To troubleshoot this you could add Write-Host $OctopusParameters and it will dump all of the available parameters scoped for that step.
This might allow you to troubleshoot this.

Also I noticed you have $sktContent = $OctopusParameters["SKTContext"] are Content and Context both, or is the second a typo and should be Content ?


SKTContext is a variable I set in the Library Variable Set…I would like to access these variables when executing a PostDeploy.ps1 file…it would prevent me from creating a properties file.

I will try to the dump to see if i come up with anything

No…it is not a typo…i want to put the value of the Octopus variable into the powershell variable within the script

I am using Octopus and I can see that this threads purpose is not resolved in the GIThub issue posted above.


Hi Altaf,

I don’t know if I understand your comment. The GitHub issue and the overall problem in this thread has been resolved and is working.
If you are having specific problems with variables could you provide the information, any support documentation such as screenshots or powershell and we can try to help you with your variables not working.


Hello Venessa,

Perhaps it was a mistake from my end. I was trying to access variables ?in powershell as #{variablename}. But now I have corrected that by using $variablename and found its working fine.


Apologies for the comment.


Hi Altaf,

Not a problem at all, I am glad you figured this out. The variables usage can be confusing as it is used in 3 different ways depending on where you need it resolved.