繁体   English   中英

无法在 Powershell 中安装 SQLServer 模块

[英]Cannot install SQLServer module in Powershell

我尝试通过以管理员身份(win10,64Bit)执行以下命令来安装 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\1.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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM