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 installing sql instances through script, and after creating a certain instance, I cannot get the sa account to be enabled through osql.

What I've tried

  1. osql -S .\INSTANCENAME -E
    use master

  2. Using SSMS to enable the account (by logging in using Windows Auth., 'New query', and exactly the same query as in 1.)

  3. Suggestions in this issue

No. 2. is actually working; and the account is enabled instantly. No 1 is not working, not even with the suggestions provided in 3., I have restarted the SQL services after executing the commands in osql.

Additional info
Windows 2003 Server, Microsoft SQL Server 2005 Enterprise, No password policies apply to the account.

share|improve this question
Do you get an error from #1? – squillman Aug 18 '09 at 12:30
Chris' answer is likely the problem; when you install you need to specify mixed mode and set the password. If SA is disabled right after an install then mixed mode is not turned on. – Jason Cumberland Oct 5 '11 at 14:34

You do not state, but the syntax .\instancename implies that you are running your OSQL on your target server? Is this the case? Have you tried Servername\instancename?

share|improve this answer

Your Answer


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