title: Connecting to DB with Windows authentication uses Domain\Machine$ user in SQL Server 2016 but it uses Machine\user in SQL Server 2008R2
body: <p>I have a bizarre situation here. I desperately need your help, SQL guru or WCF masters!</p>
  
  <p>I have a WCF application (C#) which talks to a SQL Server database with Windows authentication.</p>
  
  <p>On machine A, I installed SQL Server 2008 R2 Express and the user being used when connecting to the database with Windows authentication is <code>NT Authority\NETWORK SERVICE</code>. As this user has already been added to my database it connects successfully without issues.</p>
  
  <p>On machine B, I installed SQL Server 2016 Express and the user name being used when connecting to the database with Windows authentication is <code>Domain\Machine$</code>.  As <code>NT Authority\System</code> has been added my SQL server, it connects successfully but not able to connect to my database.  </p>
  
  <p>I am not sure how the user for Windows authentication can be different per SQL Server version. Simple resolution would be altering user mapping of <code>NT Authority\System</code> for my database but not so sure if I want that.</p>
  
  <p>Does anyone know what possibly affects the user name being used for Windows authentication? If there is nothing we can do about it, what's the best approach would be for this issue?</p>
  
  <p>Both machines are not in the domain yet (just in <code>WORKGROUP</code> as Win 10 OS default image). Both SQL Server services are running as <code>NT Authority\NETWORK SERVICE</code>.</p>
  
  <p>Further information:</p>
  
  <ul>
  <li><p>Both SQL Servers have been installed with following parameters:</p>
  
  <pre><code>/QS /ACTION=Install /FEATURES=SQL,SDK /INSTANCENAME="SQLEXPRESS"
  /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /SECURITYMODE=SQL
  /SAPWD="ourpassword"
  /SQLSYSADMINACCOUNTS="$SQL_COMPUTER_NAME$\$SQL_USER_NAME$"  
  /IAcceptSQLServerLicenseTerms
  </code></pre></li>
  <li><p><code>$SQL_COMPUTER_NAME$\$SQL_USER_NAME$</code> gets replaced with proper computer and username that logged in. </p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/QLZ6o.png" rel="nofollow noreferrer">Screenshots</a> has got detailed error messages obtained from SQL Server login history. First 3 (89,90 and 91) are captured in Machine A.  Second 3 (456-458) are captured from Machine B. </p>