SQL PowerShell 管理单元问题

SQL PowerShell Snapin Problems

我目前正在尝试执行命令 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?

sqlserver 模块和 SQL 服务器管理单元不是一回事。因此,存在的模块并不意味着管理单元已注册以便您加载它。看看 MSDN 上的 Running SQL Server PowerShell。如果您需要 SqlServer 模块,请尝试以下操作:

Import-Module sqlserver