DaveWentzel.com            All Things Data

2005 and 2008 Version Differences


SMO

SMO loads with 2008 automatically when you run sqlps.  On 2005 PS does not load the SMO dlls by default, you have to load them manually.  To do that:

 

 


[reflection.assembly]::loadfile("C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll")


[reflection.assembly]::loadfile("C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll")


[reflection.assembly]::loadfile("C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll")


[reflection.assembly]::loadfile("C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll")


$server = New-Object Microsoft.SQLServer.Management.SMO.Server -Argumentlist "yourSQL2005Server"


You can add these statements to a PS profile or to a script file directly. 

 

Add new comment