title: Using WMI to get SQL Server 2008 version fails
body: <p>I'm trying to get the version of SQL Server 2008 and above version using WMI, I'm using the class of ComputerManagement10 and the query of </p>
  
  <pre><code>select PropertyStrValue 
  from SqlServiceAdvancedProperty 
  where PropertyName = \'VERSION\' and ServiceName =\'MSSQL$SQL2008R2SP1'\'
  </code></pre>
  
  <p>where <code>ServiceName</code> is the instance of the SQL Server.</p>
  
  <p>I experience a strange problem that the expected result (PropertyStrValue field) I get is different from the regular <code>select @@version</code> or the "Right click -> Properties" (of <code>sqlservr.exe</code>)</p>
  
  <p>The version WMI gets is "10.51.2500.0" while the original one is "10.50.2500.0"</p>
  
  <p>I checked more than twice to be sure that this is the correct instance, SQL Server, host, etc, but it seems that I am not the only one who experienced this sort of thing.</p>
  
  <p>Does anyone know why is this behavior happening and how to fix it ? </p>
  
  <p>Does anyone know if it's reliable to use WMI to retrieve the version of SQL Server ?</p>
  
  <p>Thanks in advance.</p>