sql-serverpowershellpssnapin

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?


Solution

  • 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