$ Get-InstalledModule -Name Az -AllVersions
Version Name Repository Description
------- ---- ---------- -----------
0.5.0 Az PSGallery Azure Resource Manager Module. Cmdlets to manage...上面的块显示安装了Az。但是下面的代码块说的并非如此:
$ Update-Module -Name Az
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'Az'. Try
Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 char:20
+ ... $sid = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage发布于 2019-04-13 09:27:42
感谢大家在评论中的帮助……这里的主要问题是存储库本身。取消注册并重新注册解决了问题。
> Register-PSRepository -Default发布于 2021-08-17 18:11:41
使用TLS1.2连接解决了这个问题。在安装模块Az之前尝试执行以下命令-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name Az -AllowClobber -Scope CurrentUserhttps://stackoverflow.com/questions/55648863
复制相似问题