Connect to SQL Server using powershell

Question:

I am using this powershell script below to connect to an instance of sql server. I am pretty sure that my username and password are correct.

$connectionString = “server={0};database={1};uid={2};pwd={3};”

It is always falling to the default statement.

Answer:

Your call to $conn.open is missing the (), so it would be returning a reference to that method rather than calling it.

Source:

Connect to SQL Server using powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply