无法在 Powershell 中安装 SQLServer 模块

Cannot install SQLServer module in Powershell

我尝试通过以管理员身份(win10、64 位)执行以下命令来安装 Powershell SQLSERVER 模块,但它失败了

PS C:\WINDOWS\system32> Install-Module -Name SqlServer
PackageManagement\Install-Package : No match was found for the specified search 
criteria and module name 'SqlServer'.
Try Get-PSRepository to see all available registered module repositories.
At C:\Program 
Files\WindowsPowerShell\Modules\PowerShellGet.0.0.1\PSModule.psm1:1809 
char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: 
(Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : 

NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.
InstallPackage

我在网上搜索过,尝试过一些解决方案,甚至与公司管理员交谈过,但都没有成功。正如他们告诉我的那样,公司没有代理,只有防火墙。其他同事可以 运行 命令没有问题。下一个命令也失败了

PS C:\WINDOWS\system32> Get-PSrepository
WARNING: Unable to find module repositories.

有什么想法吗?

我运行进入这个。我必须 运行 以下内容:

Register-PSRepository -Default
Register-PSRepository -Name PSGallery -InstallationPolicy Trusted -SourceLocation "https://www.powershellgallery.com/api/v2/" -Verbose

这里出错了。然后我就可以 运行

Install-Module sqlserver

我的已修复启用 tls 1.2

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

对@Daniel_Carlozzi 的回答过于详细,在提升的 PowerShell window 中,我 运行 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 没有产生任何输出,然后 Install-Module -Name SqlServer -AllowClobber 发出警告关于不受信任的存储库。