Powershell output is being hidden.

zachary.bonjour's Avatar


09 Mar, 2022 05:36 PM

I am trying to execute the following command:

$dotnetef = Start-Process -FilePath "dotnet.exe" -ArgumentList "ef database update -c $($env:DBCONTEXT)" -WorkingDirectory $WorkingDir -NoNewWindow -wait -PassThru

This command works most of the time. However sometimes it fails, and I would like to see the output of dotnet.exe to find out why. The ci.appveyor.com console screen does not show the output of this command. No matter how I redirect it, it is hidden.

In my local environments both PS5.1 and PS7+ show the outputs of dotnet.exe as long as I have "-NoNewWindow" enabled on Start-Process (which I do).

Why is this PS behavior different in appveyor and why am I unable to redirect it so it is visible?

  1. Support Staff 1 Posted by Feodor Fitsner on 09 Mar, 2022 06:06 PM

    Feodor Fitsner's Avatar

    StdOut/StdErr redirection doesn't work the same way as in Windows console and when catching the output programmatically. In Windows the API for collecting process output is very limited (compared to Linux/macOS).

    You can use this helper method using Start-Process and redirecting output: https://github.com/appveyor/build-images/blob/master/scripts/Window...

  2. 2 Posted by zachary.bonjour on 09 Mar, 2022 07:09 PM

    zachary.bonjour's Avatar

    That looks good! Is that function available to run by default, or do I need to load that "common.ps1" script first?

  3. Support Staff 3 Posted by Feodor Fitsner on 09 Mar, 2022 07:10 PM

    Feodor Fitsner's Avatar

    You need to copy it to your scripts.

  4. Feodor Fitsner closed this discussion on 09 May, 2022 09:02 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