Which version of IIS? If using 5.1 or 6, you'll have to use com objects to get there. If using 7, you have the option of new classes in .net.
For 5.1 and 6, I tend to use ADSI, rather than WMI, because I've seen a lot of systems where WMI is flaky or not installed correctly. Unsure how this happens, but I've never run across a problem using the ADSI objects. Note: You can actually still use these under IIS 7, but you need to enable the IIS 6 Management Compatibility option, under add/remove windows features.
For more information on IIS7-based objects, check out:
Creating Virtual directory in IIS with c#