Loading SMO In Powershell

Chrissy LeMaire shows how to load SMO with full names when you don’t know which version is installed:

In a recent version of PowerShell, Publish-Module, which publishes modules to the Gallery began requiring fully qualified Assembly names such as “Microsoft.SqlServer.Smo, Version=$smoversion, Culture=neutral, PublicKeyToken=89845dcd8080cc91”.

Previously, it was sufficient just to use short names such as Microsoft.SqlServer.Smo. This had similar behavior to LoadWithPartialName.

I get that LoadWithPartialName is sketchy, but the solution that Chrissy has to do seems overly complicated to me.  Nonetheless, those are the rules of the game now, I suppose.

Related Posts

Interlinked Parameters In Powershell

Rob Sewell shows how to make one parameter’s valid set of values depend upon a previous parameter’s selected value: But what Sander wanted was to validate the value of the second parameter depending on the value of the first one. So lets say we wanted If word is sun, number must be 1 or 2 […]

Read More

Stopwatches

Drew Furgiuele explains how to use the .NET Stopwatch class in Powershell: We can see I cleared the history buffer of my session ( Clear-History ), then ran a script. It’s nothing fancy; just connecting to my local instance of SQL Server and outputting a list of tables to a text file. With Get-History , I can […]

Read More

Categories

December 2016
MTWTFSS
« Nov Jan »
 1234
567891011
12131415161718
19202122232425
262728293031