简体   繁体   中英

SQL PowerShell Snapin Problems

I am currently trying to execute the command add-sqlsnappin

which give me error message

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.

Which cannot be true since

if (Get-Module -ListAvailable -Name SqlServer) {
>>     Write-Host "Module exists"
>> } else {
>>     Write-Host "Module does not exist"
>> }
Module exists

so why can i not add-sqlsnapin?

The sqlserver module and SQL Server snap-in aren't the same thing. So, the module existing doesn't mean the snap-in is registered in-order for you to load it. Give the Running SQL Server PowerShell on MSDN a look. If you want the SqlServer module, try the following:

Import-Module sqlserver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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