SQL PowerShell Snapin问题

时间:2018-04-20 09:05:11

标签: sql-server powershell pssnapin

我目前正在尝试执行该命令 add-sqlsnappin

给我错误信息

SQL Server Provider for Windows PowerShell is not installed.
At C:\deploy\SIF.Sitecore.Commerce.1.1.4\Modules\DeployCommerceDatabase\DeployCommerceDatabase.psm1:215 char:9
+         throw "SQL Server Provider for Windows PowerShell is not inst ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (SQL Server Prov... not installed.:String) [], RuntimeException
    + FullyQualifiedErrorId : SQL Server Provider for Windows PowerShell is not installed.

以来不可能是真的
if (Get-Module -ListAvailable -Name SqlServer) {
>>     Write-Host "Module exists"
>> } else {
>>     Write-Host "Module does not exist"
>> }
Module exists

那为什么我不能添加-sqlsnapin?

1 个答案:

答案 0 :(得分:0)

sqlserver模块和SQL Server管理单元不是一回事。因此,现有模块并不意味着按顺序注册了管理单元以供您加载。在MSDN上查看Running SQL Server PowerShell。如果需要SqlServer模块,请尝试以下操作:

Import-Module sqlserver