Improved Formatting of PowerShell's `Format-Table` Command

I have the following command in one of my PowerShell scripts:

$unfinishedRedeployments | Format-Table

When I run this from a normal console it looks like this:

But when I run it in Octopus Deploy, it looks like this:

As you can see the spacing is all messed up and more than half of the columns are missing.

Is there someway I can get PowerShell’s Format-Table command to output correctly to Octopus Deploy’s logs?

Hi @OctopusSchaff,

Thanks for getting in touch! I’m sorry to see you’re hitting this unexpected difference in behavior. I haven’t been able to reproduce this, however. Tables seem to be formatted in the same way in my testing. Would you be willing to enable debugging variables, create and deploy a new release and send the resulting verbose task log? Hopefully that’ll point us in the right direction in figuring this out, or help in reproducing this more accurately.

I look forward to hearing back!

Best regards,


I am happy to run it with the debugging variables, but I should have mentioned in my original post that this tentacle is a Linux Tentacle. If this does not repro on a windows tentacle, then I would imagine this is a Linux specific problem. (I have had other formatting issues in regards to a Linux Tentacles and PowerShell in the past.)

In case it is relevant, my Tentacle is running version 6.1.1409 of the container image and PowerShell 7.2.2.

Sorry for not mentioning this right away. If this does not repro on a Linux Tentacle, I will setup a run with the debug variables.

Hi @OctopusSchaff,

Thanks for following up and for your additional information. I have been able to reproduce a portion of this issue when run on Linux, however only the formatting issue. It looks like the e[32;1m correlates to ANSI color code, and instead of just being hidden they’re inserted into the start of the line, pushing the column headers and --- separators over 7 spaces but not the data beneath.

It looks like we’ll need to suppress this color coding in the script with something like what’s shown in the following external forum: regex - Removing ANSI color codes from text stream - Super User

I haven’t sorted out a definitive solution in my local repro, but just wanted to let you know I’m still working on this one and hoping to get something working today.

Regarding the outright missing columns, e.g. Environment, TenantName, etc. I’m wondering if this might be related to permissions. When you run the same script via the console, compared to when running it against your Linux target in Octopus, are these run as different users? Perhaps there’s a discrepancy between the two users and their privileges to see these specific objects. E.g. something like the API key used in your Octopus script is owned by a user who does not have permission to view the Dev and DevUnstable environments, and similarly they cannot view your Blue & Green tenants?

Best regards,


Thank you for looking into this.

The color code thing makes sense, though I have to wonder why PowerShell put that into the Linux version if it is not there in the Windows version.

As for the permissions, the user I am making the calls as (via the API Key) is a Space Manager for all the Octopus Deploy space’s my scripts run in or access. Additionally, I access the underlying data in some conditionals and other logic and it all works correctly.

Not a problem at all, it’s an interesting one. :slight_smile:

I’m still attempting to sort this one out, but I agree it does seem odd that it’s putting that in when running on Linux but not Windows.

I think it’d be worth attempting to repro this exactly as you have it to also get a look at the other issue not showing the other columns and their data at the same time. How is the $unfinishedRedeployments variable built up? Would you be willing to share your full script for me to test (retracting any sensitive details)? Feel free to upload it here if preferred.

Best regards,