You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling powershell.exe in PSCore6 on Windows starts Windows PowerShell #4194
On Windows, $env:Path has Windows PowerShell in the path before $PSHOME which means that if you're in PowerShell Core 6 and type powershell, it starts Windows PowerShell 5.1 instead of a nested instance of PowerShell Core 6. This may be unexpected for end users as it seems that one would expect powershell to refer to the currently running version of PowerShell.
The immediate impact is that partner teams running existing PowerShell script tests in PowerShell Core 6 that spawn powershell will get incorrect results as that process is running Windows PowerShell.
# within PowerShell Core 6
powershell
$psversiontable
Expected behavior
PowerShell Core 6
Actual behavior
Windows PowerShell 5.1
Environment data
Name Value
---------
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.3
OS Microsoft Windows 10.0.16225
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
If we have some PowerShell versions on system we should think about "default PowerShell" and a way to run specific PowerShell version by -Version parameter.
A rule may be "By default Windows PowerShell run Windows PowerShell, PowerShell Core run PowerShell Core".
Steve Lee (@SteveL-MSFT): other implications of this worry me. E.g. it might mean that anyone who can write to $PSHome can now squat over system binaries from within PowerShell. Let's talk offline.
In my own opinion, we should kept then separately. As soon the PowerShell Core installation overrides any of the existing Windows variables over the Windows PowerShell it could open issues across the board.
Joey Aiello (@joeyaiello) PSCore6 implicitly trusts binaries in $PSHome so that folder needs to be secure regardless. The only change being proposed here is to move $PSHome to front of $env:Path (at the process level, not system or user setting) instead of the end so that it takes precedence over Windows PowerShell path.
Activity
iSazonov commentedon Jul 6, 2017
Steve Lee (@SteveL-MSFT) Maybe Area-SideBySide?
iSazonov commentedon Jul 6, 2017
If we have some PowerShell versions on system we should think about "default PowerShell" and a way to run specific PowerShell version by
-Versionparameter.A rule may be "By default Windows PowerShell run Windows PowerShell, PowerShell Core run PowerShell Core".
SteveL-MSFT commentedon Jul 6, 2017
Based on some internal discussions, I think we agree that on Windows, we should put $PSHOME first in $env:PATH rather than at the end.
iSazonov commentedon Jul 7, 2017
What about to enhance
-Version?SteveL-MSFT commentedon Jul 7, 2017
Ilya (@iSazonov) I think you should open a separate issue to discuss that
iSazonov commentedon Jul 7, 2017
Done #4199
joeyaiello commentedon Jul 10, 2017
Steve Lee (@SteveL-MSFT): other implications of this worry me. E.g. it might mean that anyone who can write to $PSHome can now squat over system binaries from within PowerShell. Let's talk offline.
MaximoTrinidad commentedon Jul 10, 2017
In my own opinion, we should kept then separately. As soon the PowerShell Core installation overrides any of the existing Windows variables over the Windows PowerShell it could open issues across the board.
:)
SteveL-MSFT commentedon Jul 13, 2017
Joey Aiello (@joeyaiello) PSCore6 implicitly trusts binaries in $PSHome so that folder needs to be secure regardless. The only change being proposed here is to move $PSHome to front of $env:Path (at the process level, not system or user setting) instead of the end so that it takes precedence over Windows PowerShell path.
SteveL-MSFT commentedon Jul 13, 2017
If we decide to do #4214, we don't need to address this one