DSC powershell script throws error but Octopus ignores it and moves to next step

I am trying to install an MSI using DSC script and even if there is a failure while installing the MSI and error displayed in Octopus the deployment does not fail and that step is displayed with only a warning.I have tried adding try/catch,$ErrorActionPreference = “Stop”, error count but nothing is working.
The error is clearly displayed in the logs attached as well as octopus deployment step:

I even tried to change the flag to -
Required This step is required and cannot be skipped

Please suggest

Hi Team,
Adding -ErrorAction Stop to DscOnfiguration helped in this case.
Start-DscConfiguration -Path $path -ComputerName localhost -Wait -Verbose -Force -ErrorAction Stop


Hi Saurabh,

That is fantastic news that you’ve worked out the error. Thank you for letting us know what you’ve discovered.

If you haven’t seen it yet, there’s also this run-through of how Octopus handles Error reporting from Powershell.


Best Regards,