Reputation: 409
I am trying to install a company tool by Powershell in Windows 10, it requires PowerShell version 7.0+, but it looks like I have two versions of PowerShell in my Windows when I try to call our company tool I got this error:
The 'Tool-Name' command was found in the module 'PCP.AWS', but the module could not be loaded. For more information, run 'Import-Module PCP.AWS'.
Then I run the command 'Import-Module PCP.AWS' but I got this error:
Import-Module : The version of Windows PowerShell on this computer is '5.1.18362.145'. The module 'C:\Program Files
(x86)\WindowsPowerShell\Modules\PCP.AWS\0.0.23\PCP.AWS.psd1' requires a minimum Windows PowerShell version of '7.0' to run. Verify that you have the minimum required version of Windows PowerShell installed, and then try again.
Here's the output when I run pwsh -V PowerShell 7.1.0
, but if I run Get-Host | Select-Object Version I can also get an output
Version
-------
5.1.18362.145
Can anyone suggest what should I do to get this tool runnable? Should I run this tool by specific PowerShell version or should I just remove the older version PowerShell in my laptop?
Upvotes: 0
Views: 4936
Reputation: 7067
The problem may be you're running Windows PowerShell version 5.1.x. When you run pwsh -v
, you are actually invoking the PowerShell core executable from the 5.1 shell and it's returning its output (PowerShell 7.1.0) to the 5.1 shell and promptly exiting. That's why when you run $host you are getting 5.1.x
As such you obviously have 7.1 installed side by side with Windows PowerShell. Go to start Run type pwsh and hit enter. Now you'll be in a 7.1 shell, go ahead and load the module.
Note: you can also find PowerShell Core by searching from the start menu. It may be labeled "PowerShell 7 (x64). The executable is located at "C:\Program Files\PowerShell\7\pwsh.exe"
Last note: The best way to check the PowerShell version in your Shell is via the $PSVersiontTable
automatic variable. The output will look like below:
Name Value
---- -----
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14409.1018}
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The output is a little different in PwSh 7.1:
Name Value
---- -----
PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
If you need version 7.1, you have it, then use it...
Upvotes: 1