title: Update WMI Instance Properties
body: <p>I'm trying to update the TcpPort to "1433" and TcpDynamicPorts to "" using C# but none of the changes I make are taking affect. I can find the Instances in C# that I want to update and then confirm the properties exist in the instance but any update method gets ignored without error.</p>
  
  <pre><code>try
  {
      var searcher = new ManagementObjectSearcher(@"\\.\root\Microsoft\SqlServer\ComputerManagement10",
          "select * from ServerNetworkProtocolProperty where InstanceName='SQLEXPRESS' and ProtocolName='Tcp' and IPAddressName='IPAll'");
      foreach (ManagementObject instance in searcher.Get())
      {
          PutOptions options = new PutOptions();
          options.Type = PutType.UpdateOnly;
  
          foreach (var property in instance.Properties)
          {
              if (property.Name == "PropertyName" &amp;&amp; (string)property.Value == "TcpPort")
              {
                  instance.SetPropertyValue("PropertyStrVal", "1433");
              }
  
              if (property.Name == "PropertyName" &amp;&amp; (string)property.Value == "TcpDynamicPorts")
              {
                  instance.SetPropertyValue("PropertyStrVal", "");
              }
          }
          instance.Put(options);
      }
  }
  catch (ManagementException e)
  {
      Console.WriteLine("An error occurred setting the WMI data: " + e.Message);
  }
  </code></pre>
  
  <p>Can anyone advise what I'm doing wrong? When I query the properties via WMI Explorer 2.0 everything has stayed the same.</p>