Windows is using PowerShell Core instead of PowerShell as documented #26868
-
Hi! I have another thing that confuses me: It seems Actions uses PowerShell Core and not the default Desktop PowerShell. My workflow action:
The output:
As far as i know this refers to PoweShell 6, which is PowerShell Core. The default PowerShell on Windows Server 2019 is PowerShell 5.1. The documentation says:
This seems like a bug. Regards, Michael |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Hi, Thank you for taking time to report this! Powershell 6.2.3 is the correct version which will be invoked, please refer to my screenshot below. The twitter link: https://twitter.com/GitHubHelp/status/1186648849995177985 I also checked the github runner env, only powershell 6.2.3 is installed. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks for your anwser! Am i correct, that the output for using shell: powerstell and shell: pwsh is the same on Windows? If shell: powershell also calls Powershell Core it would be safe to remove the shell: powershell completely and just make shell: pwsh the default. AFAIK Poweshell 5.x is installed by default on Windows Server 2019. Therefore the virtual env docs might not have reflected this properly? Anyway it seems confusing to have two shell options which call the same PowerShell. The docs should clearly state why this choice has been made and when i should use shell: powershell and when to use shell: pwsh. At the moment i am not confident to make a proper choice. (When reading the docs it seems that the difference should have been PowerShell Core vs PowerShell Desktop. If this difference was purposely then this is indeed a bug and shell: powershell should properly call the shipped PowerShell which is 5.x) Regards, Michael |
Beta Was this translation helpful? Give feedback.
-
It did some more research on this. I have a stock Windows Server 2019 installation. Running in the Desktop PowerShell:
Running in the additionally installed PowerShell Core:
The documentation states the following: (https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions)
The Desktiop edition is clearly the one with version 5.1.x. Therefore this seems like either a totaly wrong documentation (and as suggested a redundant shell: powershell option) or a bug that the wrong PowerShell is called. Regards, Michael |
Beta Was this translation helpful? Give feedback.
-
It is definitly a bug. Using a custom shell as specified in the documentation will properly run the stock Desktop Powershell. My modified workflow:
Here is the output Using the default shell will run the PowerShell Core. Regards, Michael |
Beta Was this translation helpful? Give feedback.
-
Thanks for your feedback! There are two parameters here: pwsh / powershell, for “shell: pwsh”: powershell core(6.2.3) will be invoked. for “shell: powershell”: desktop powershell(5.1) will be invoked. If you didn’t point out the shell parameter, powershell core will be invoked as it’s default. As offical doc says: Users can always opt out by not using the built-in shell, and providing a custom shell option like: pwsh -File {0}, or powershell -Command “& ‘{0}’”, depending on need. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification. So it is just a simple documentation issue, which states that PowerShell Desktop is the default instead of PowerShell Core. Regards, Michael |
Beta Was this translation helpful? Give feedback.
-
I have fallen for this one again. Could you fix the documentation and correctly state that Powershell Core is the default shell on Windows? |
Beta Was this translation helpful? Give feedback.
Thanks for your feedback! There are two parameters here: pwsh / powershell,
for “shell: pwsh”: powershell core(6.2.3) will be invoked.
for “shell: powershell”: desktop powershell(5.1) will be invoked.
If you didn’t point out the shell parameter, powershell core will be invoked as it’s default.
As offical doc says:
Users can always opt out by not using the built-in shell, and providing a custom shell option like: pwsh -File {0}, or powershell -Command “& ‘{0}’”, depending on need.
Thanks.