title: How can I look up IIS site id in C#?
body: <p>I am writing an installer class for my web service. In many cases when I use WMI  (e.g. when creating virtual directories) I have to know the siteId to provide the correct metabasePath to the site, e.g.:</p>
  
  <pre><code>metabasePath is of the form "IIS://&lt;servername&gt;/&lt;service&gt;/&lt;siteID&gt;/Root[/&lt;vdir&gt;]"
  for example "IIS://localhost/W3SVC/1/Root" 
  </code></pre>
  
  <p>How can I look it up programmatically in C#, based on the name of the site (e.g. for "Default Web Site")?</p>