Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

PowerShell SMO Breaks With LocalDB 2014

$
0
0

Hi. I have a script that I've been using a while that does some SQL configuration.  I just got done with new elevation, UAC, and share access issues for my SQL install scripts.  Now I can't get the first configuration script to run.  Anyway, I have SQL 2012 developer install on my desktop along with VS 2012.  I use the following to load the assemblies I need. 

[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null

It still works with SQL 2008 R2 servers.  It stopped working with SQL 2012 servers.  I get he following error. 

The following exception was thrown when trying to enumerate the collection: "SQL Server WMI provider is not available on SQLSERVERNAME."

I tried running it from a new production server (Windows 2012 R2 and SQL 2012) and it worked.  I noticed that my localdb with VS 2012 is SQL 2014 and that I have share management object for 2014.  I have to wonder if this is the source of my issue.  Does anybody know how I fix this? 

Also, I tried to use http://msdn.microsoft.com/en-us/library/hh245202.aspx, but I have a different reg value.  Mine has a sqlps110 rather than sqlps.  Also, the SQLPS.exe and the SQLProvider.Format.ps1xml files are in different folders. 

D:\SQL2012 (x86)\110\Tools\Binn\SQLPS.exe

D:\SQL2012 (x86)\110\Tools\PowerShell\Modules\SQLPS\SQLProvider.Format.ps1xml

Thanks.


Randy in Marin


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>