簡體   English   中英

PowerShell x64 無法識別 Install-Module 無法識別為 cmdlet 的名稱

[英]PowerShell x64 does not recognize Install-Module is not recognized as the name of the cmdlet

我知道 Install-Module 是 PowerShell 5 或更高版本的功能。

我正在使用 OS-build:19042.746 運行 Windows 10 專業版 20H2

我使用$PSVersionTable檢查了 PS 的版本。 output 如下所示。

PS C:\Windows\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

我在尋找修復程序時發現的另一件事是, PowerShell x86版本工作正常,沒有任何問題。

我無法運行 Window 管理框架 5.1,因為它是為了讓其他系統升級 PowerShell。 但是,我正在運行最新版本。

64位有什么解決辦法嗎?

我發現的一種解決方法是將Program Files (x86)\WindowsPowershell中的Modules文件夾復制到Program Files\WindowsPowershell (64 位文件夾)。 不知何故,這些模塊已從 64 位 Powershell 文件夾中刪除。 我無法確定確切原因,但我懷疑罪魁禍首可能是KB5001330更新。

呵呵,不知道這是不是bug?

PowerShell x86 版本工作正常,沒有問題。

此評論沒有意義,因為Install-ModulePowerShellGet模塊的一部分,它不應該關心您是否正在運行 x64 或 x86 shell。 無論如何,這里有一些你可以嘗試的事情。

# check if PowerShellGet is available locally
Get-Module PowerShellGet -List

# check if PackageManagement is available locally
Get-Module PackageManagement -List
  • 您是否運行過 Windows 更新? 如果沒有:運行它,重新啟動,重復直到沒有任何東西。
  • .NET應該已經安裝了操作系統 - 檢查是否是。
# Needs to be run in an Admin shell. Alternatively, us the gui in next point
Get-WindowsOptionalFeature -Online -FeatureName NetFx* | Format-Table

# if not, you can add it by going typing 'windows feature' in the start menu and going to
# 'Turn Windows feature on or off'

我不知道這是否是一個錯誤。 我剛剛重新安裝了 windows,問題得到了解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM