Problem accessing SQL Server from PowerShell

Question:

I’m trying to implement a backup management script i found at http://sev17.com/2011/03/restore-and-relocate-database-files-using-powershell/

The article says it depends on SQLPSX version 2.3.2.1 or higher – I have the most current version.

attempting to execute this line:

results in:

result of get-module -listAvailable

RE: SMO

results:

Answer:

Make sure the Assembly containing the Microsoft.SqlServer.Management.Common.ServerConnection type (which I think is Microsoft.SqlServer.ConnectionInfo) is loaded first:

Source:

Problem accessing SQL Server from PowerShell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply