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
Windows PowerShell started from a pwsh.exe from preview.4 gives preference to pwsh module path.
As an effect, module load fails with Modules_InsufficientPowerShellVersion,Microsoft.PowerShell.Commands.ImportModuleCommand
Steps to reproduce
PS D:\> powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS D:\>Write-Verbose"Test"-verbose
Write-Verbose : The 'Write-Verbose' command was found in the module 'Microsoft.PowerShell.Utility', but the module could not be loaded. For more information, run 'Import-ModuleMicrosoft.PowerShell.Utility'.
At line:1 char:1+Write-Verbose"Test"-verbose
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-Verbose:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
PS D:\>Import-Module Microsoft.PowerShell.Utility
Import-Module : The version of Windows PowerShell on this computer is '5.1.18200.1000'. The module 'C:\programfiles\powershell\6-preview\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1' requires a minimum Windows PowerShell version of '6.1' to run. Verify that you have the minimum
required version of Windows PowerShell installed, and then try again.
At line:1 char:1+Import-Module Microsoft.PowerShell.Utility
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\program file...ll.Utility.psd1:String) [Import-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_InsufficientPowerShellVersion,Microsoft.PowerShell.Commands.ImportModuleCommand
Workaround
After starting Windows PowerShell adjust the PSModulePath
>$PSVersionTable
Name Value
---------
PSVersion 6.1.0-preview.4
PSEdition Core
GitCommitId 6.1.0-preview.4
OS Microsoft Windows 10.0.18200
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Windows PowerShell started from a pwsh.exe from preview.4 gives preference to pwsh module path.
As an effect, module load fails with
Modules_InsufficientPowerShellVersion,Microsoft.PowerShell.Commands.ImportModuleCommandSteps to reproduce
Workaround
After starting Windows PowerShell adjust the PSModulePath
cc @rjmholt
Expected behavior
Actual behavior
Environment data