Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

When doing it that way, the path is:

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

share|improve this question
up vote 4 down vote accepted

Have a look here:

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

share|improve this answer

You can also do a one-off using the Invoke-Sqlcmd statement. You have to have the SQL 2008 Powershell host installed for this (sqlps.exe) which gets installed with SQL 2008.

PS C:\> sqlps
PS>invoke-sqlcmd -query "SELECT * FROM sys.databases" -serverinstance "foo" -username "homer" -password "simpsonsrock"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.