0

Hi I have been having some issues getting invoke-sqlcmd working from one of my machines. I followed these instructions: Problems using SQL Server 2008 R2 PowerShell extensions outside of SQLPS

I also installed https://www.microsoft.com/en-us/download/details.aspx?id=42295 SharedManagementObjects and PowershellTools using DSC and confirmed in output that it's installed. But when I tried to add it using:

Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100 

It throws an error message that

SqlServerCmdLetsnapin100 and SqlServerProviderSnapin100 are not installed on the computer

I also tried importing sqlps module. The machine I'm having this issue on is Win 2012 R2.

Thanks

Note: This is happening randomly on a few machines. We need the sql provider snap installed on all machines.

Community
  • 1
  • 1
jramacha
  • 117
  • 2
  • 13
  • For anyone looking,Someone answered on twitter. Proving full path works ..https://technet.microsoft.com/en-us/library/hh849725.aspx Import-Module -Name c:\ps-test\modules\test -Verbose – jramacha May 12 '16 at 18:24
  • You can answer your own question--please either answer it or delete the question. Thanks! – Tony Hinkle May 12 '16 at 18:51
  • Tony, It didn't let me answer the question, it threw an error that I cannot answer my question, that's why I posted it as a comment. HTH – jramacha May 13 '16 at 13:51

1 Answers1

0

[Credit to OP for answer in comments]

Providing the full path to the module resolved the issue. Please see http://technet.microsoft.com/en-us/library/hh849725.aspx

Import-Module -Name c:\ps-test\modules\test -Verbose

Tony Hinkle
  • 4,706
  • 7
  • 23
  • 35