Skip to main content

Posts

Showing posts from December, 2014

Getting SQLPSX to work with SQL Server 2012

A few years ago, I wrote PowerShell scripts to assist our IT Risk department with auditing and ID management. With the deployment of SQL Server 2012 in our environment those scripts are starting to show their age.  The scripts were designed to run from a central server and they use SQL Server PowerShell Extensions version 1.6.1.  The scripts are throwing errors when trying to connect to SQL Server 2012 instances. The SMO assemblies are loaded with the following code by LibrarySmo.ps1: If I run this bit of code on our central server it returns the Version 10 SMO assemblies that allow it to connect to SQL Server 2008 R2 and below. Running this code on my laptop or server that has the SQL Server 2012 tools installed returns the Version 11 SMO assemblies which allow the scripts to run on SQL Server 2012. In addition, if the scripts are copied to a server with SQL Server 2012 installed, they run successfully because the code above is loading the later version of the SMO asse