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 need to create a number of ODBC connections to a MS SQL Server, the clients are mainly XP machines. The connection has to use SQL server authentication - is there a way to do this remotely via command line? I think that this type of authentication may be a stumbling block? Any advice on automating or part automating this type of task would be really appreciated.



share|improve this question
IIRC (not sure, so just a comment), you can create the connections, but you won't be able to specify the password this way. – Joel Coel Mar 12 '13 at 16:54
I don't understand the "remotely via command line" bit. Are you saying you want to connect to a machine and use cmd.exe to create a text file that contains an ODBC connection string? – Max Vernon Mar 12 '13 at 17:07
Hi, I basically want to automate the creation of the odbc connection across multiple machines - I assumed command line would be the way to do this - but I'm not sure if it's possible to get around the SQL authentication issue.. – aphrek Mar 12 '13 at 17:27
Glad the answer worked for you. Please indicate it was the answer. – shiitake Mar 28 '13 at 22:00

The SQLCMD utility will probably be your best option. From what you've indicated it meets all of the requirements above: command-line, ODBC driver, SQL Authentication. The basic syntax would be something like:

sqlcmd -S <servername> -U <login>

see: sqlcmd Utility

This should work fine in Windows XP but unless you've got SQL already installed on the client machines you will need to manually install SQLCMD and the SQL Native Client. Downloads for distributable packages for both of these can be found here.

share|improve this answer
great-did what I needed, thanks. – aphrek Mar 18 '13 at 16:38

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.