Accessing output variables that are run on Octopus Server

dstevens's Avatar


08 Nov, 2017 07:10 PM


I'm trying to include a section in the email notification template that will let everyone know if there were any warnings during the deployment. I have a powershell script step in my process that gets the content of the task log and increments a variable called $warningsCount anytime a line contains the word 'warning'. I know this isn't the best solution but it will work for the time-being. That same script has the following lines:

if($warningsCount > 0) {
    Set-OctopusVariable -name "DeployedWithWarnings" -value "True"
    Set-OctopusVairable -name "DeploymentWarningsCount" -value $warningsCount

The issue is, I cannot access either of those variables in the email template step or a dummy step later in the process. I'm attempting to access it by calling:

$warnings = $OctopusParameters["Octopus.Action[Test1].Output.DeploymentWarningsCount"]

But there is nothing written to the console. Am I accessing it wrong? Any help would be great!

I'm using Octopus v3.3.10



  1. Support Staff 1 Posted by Alex Rolley on 09 Nov, 2017 06:46 AM

    Alex Rolley's Avatar


    Thanks for getting in touch!

    You were very close with your script, the only change needed is that for Powershell to evaluate > you need to use -gt, so it wasn't actually entering your loop to set the variable values. You also had misspelt the second Set-OctopusVariable, but we've all done that :)

    if($warningsCount -gt 0) {
        Set-OctopusVariable -name "DeployedWithWarnings" -value "True" 
        Set-OctopusVariable -name "DeploymentWarningsCount" -value "$warningsCount"

    Using the updated code I can then use the output variable correctly in a later step.

    Please let me know if you have any other questions,


  2. 2 Posted by dstevens on 09 Nov, 2017 02:55 PM

    dstevens's Avatar

    Welp, those were some silly mistakes. Thanks Alex!

  3. Support Staff 3 Posted by Alex Rolley on 12 Nov, 2017 11:16 PM

    Alex Rolley's Avatar

    No problems :)

    Happy deploying!


  4. Paul Stovell closed this discussion on 21 Feb, 2018 06:15 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac