3

I am hoping this is an easy fix and oversight on my part. I need to be able to run the SQL cmdlets from remote machines. I have installed Microsoft® Windows PowerShell Extensions for SQL Server® 2008 R2 (along with the other requirements), however when I try to add the pssnapin I receive the error that the snap-in is not installed on this computer.

Add-PSSnapin : The Windows PowerShell snap-in 'SqlServerCmdletSnapin100' is not installed on this computer.

Any help?

Thank

jrob24
  • 161
  • 1
  • 1
  • 2
  • Try running "Get-PSSnapin -Registered" to confirm what snap-ins are installed. It's possible the snapin is called something slightly different. Also, if you are on a 64-bit OS, trying running a 32-bit instance of PowerShell and see if "Get-PSSnapin -Registered" shows the snap-in there. – jbsmith Oct 02 '13 at 22:07
  • Thanks for the reply. So something odd, the SQL PSSnapins load fine in the 64-bit console, but give me the error "Add-PSSnapin : The Windows PowerShell snap-in 'SqlServerCmdletSnapin100' is not installed on this computer" when trying to load in the 32-bit. I really need to load these in both. Is it possible to get them loaded into both? – jrob24 Oct 11 '13 at 20:34
  • It looks like the easiest thing to do would be to install the PowerShellTools.msi file from here: http://www.microsoft.com/en-us/download/details.aspx?id=35580 This installs the latest version of SQLps as a module that is usable by both 32-bit and 64-bit PowerShell. – jbsmith Oct 14 '13 at 14:25
  • I've installed that, but still get the same error :( – J86 Mar 05 '15 at 13:24

1 Answers1

2

If you installed the 2012 PowerShellTools.msi, then you need to reference SqlServerCmdletSnapin110 (you are specifying SqlServerCmdletSnapin100).

Also - it appears sometimes you have to register the DLLs even after running the Power ShellTools.msi install. Take a look at this post for details:

https://markcz.wordpress.com/2009/12/19/how-to-register-powershell-sql-server-snapin-in-windows-preinstalled-powershell/

Note that the path to the installutil may vary depending on what version(s) of the .NET framework you have installed and the path to the DLLs will vary depending on which version of the tools you installed. I have .NET 4, and the 2012 64-bit PowerShell tools installed, so here was what worked for me:

set-alias installutil $env:windir\microsoft.net\Framework64\v4.0.30319\installutil

installutil -i "C:\Program Files\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSProvider.dll"

installutil -i "C:\Program Files\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll"

Given this is such an old post, you probably already got this resolved or found a workaround, but wanted to offer a solution for any folks that run into the problem in the future.

Frank V
  • 449
  • 4
  • 15
DanO
  • 121
  • 3