Powershell – How to login with SQL Authentication using PowerShell

powershellsql-server-2008

I'm trying to connect via SQL Server Powershell Cmdlet (read not ADO.NET) using SQL-based Authentication, not Windows Integrated security.

Anyone know the format to use for this?

  • Server: foo
  • Instance: DEFAULT
  • UserID: homer
  • Password: simponsrock

Edit:
I can get to this SQL-cmdlet path using SQL Server Management Studio.

When doing it that way, the path is:
SQLSERVER:\SQL\foo\DEFAULT+homer

The problem is that I cannot set-location to this path via PowerShell

Best Answer

Have a look here: http://msdn.microsoft.com/en-us/library/cc281947.aspx.

Your issue is dealt with in the section "Managing SQL Server Authentication Connections".