PowerShell task duplicates the output with Write-Host in the scripts

Headline:
PowerShell task duplicates the output with Write-Host in the scripts


Description:
When a result from one PowerShell task is used as input in next, the output/result under History shows duplication. This only happens when using Write-Host cmdlet in the script however with Write-Output we see the expected results.


Example/Use case(s):
PowerShell Task 1:

PowerShell Task 2:

Tasks are attached to the Provision phase of a Provisioning workflow.

When executed on instance/server context the result is seen something like this:

When the Write-Output cmdlet is use instead, the results are as expected like below:

The below article might be useful:


2 Likes

A note, this only impacts when utilizing WinRM and not with the Morpheus Agent or AzureCMD bus. One of the nice benefits of using the Morpheus Agent.

1 Like