title: SQL Server enters single user mode after cmd installation
body: <p>I am installing SQL Server Express 2017 using the command line. Once the install is done I use a batch file to create a database. The database creation fails giving a message that : login with 'sa' failed, The server is in single user mode</p>
  
  <p>I have used the installation syntax given on the msdn website and my DB creation script is a batch file which creates a DB after confirming that SQL 2017 is installed. I am logging the errors in a file which gives me the single mode error information. Below is the installation statement I am using through cmd</p>
  
  <pre><code>SETUP.exe /q /ACTION=Install /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /AGTSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSVCINSTANTFILEINIT="True" /IACCEPTSQLSERVERLICENSETERMS /SAPWD=&lt;Password&gt; /SECURITYMODE=SQL
  </code></pre>
  
  <p>The code to install the DB is :</p>
  
  <pre><code>%OSQLEXE% -S %SERVER% -U %USERNAME% -P %PASSWORD% -i "%AgentPath%\CreateDatabase.sql" &gt;&gt; c:\InstallLog.txt
  </code></pre>
  
  <p>Ideally my DB should be created but for some reason I get this error. Can someone please help?</p>