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
Windows PowerShell modules have a priority if WinCompat feature is enabled #11419
If WinCompat feature is enabled and loaded a Windows PowerShell module ,cmdlets from the module have a priority over PowerShell Core cmdlets.
/cc Andrew (@anmenaga)
Steps to reproduce
Get-Date -UFormat "%s" was changed in PowerShell Core and we use this in follow demo.
Expected behavior
Get-Date from PowerShell Core is involved.
I'd expect that PowerShell Core cmdlets have a priority or it is better WinCompat feature exports only requested cmdlet which explicitly presents in a feature list. Perhaps we could do Enable/Disable-WindowsPowerShellCmdlet -Module <name> -Cmdlet <name>
Actual behavior
Get-Date from Windows PowerShell is involved.
Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.6
PSEdition Core
GitCommitId 7.0.0-preview.6-71-g36d3b3c0e45937d56650b2747effde94c20b42aa
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Reacted by Michael Klement and Rain Sallow (/u/ta11ow)
Not convinced that Enable/Disable is needed. If you want fine-grained delegation, I'd suggest using JEA (once that starts to work properly in PowerShell 7).
The user shouldn't have to manage the experience through enable/disable cmdlets. Ideally, if the cmdlet exists in PS7, that one should be used. However, we still want to support selective proxy generation so that ConvertFrom-String is available.
While the fix is being worked on, here is a temporary workaround that can be used:
Local Core-native cmdlet can be called instead of the proxy function using call operator; e.g.: &(Get-Command -Name Import-Csv -CommandType Cmdlet) .\TestColumn.csv
or
Activity
anmenaga commentedon Jan 14, 2020
Yup, this is because proxy commands are Functions which precede Cmdlets during execution:
Enable/Disable-WindowsPowerShellCmdlet -Module <name> -Cmdlet <nameis an interesting idea.doctordns commentedon Jan 14, 2020
Not convinced that Enable/Disable is needed. If you want fine-grained delegation, I'd suggest using JEA (once that starts to work properly in PowerShell 7).
alexandair commentedon Jan 14, 2020
Thomas Lee (@doctordns) What is a problem with JEA in PowerShell 7?
SteveL-MSFT commentedon Jan 14, 2020
The user shouldn't have to manage the experience through enable/disable cmdlets. Ideally, if the cmdlet exists in PS7, that one should be used. However, we still want to support selective proxy generation so that
ConvertFrom-Stringis available.doctordns commentedon Jan 14, 2020
In my case, it does not work properly in practice in RC1. See #11538
It sounds like this is an issue, the team are aware of it, and it should be resolved by RTM (and hopefully earlier),
anmenaga commentedon Mar 5, 2020
While the fix is being worked on, here is a temporary workaround that can be used:
Local Core-native cmdlet can be called instead of the proxy function using call operator; e.g.:
&(Get-Command -Name Import-Csv -CommandType Cmdlet) .\TestColumn.csvor