Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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".

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.