Thanks to Michael for the following code clue which starts the IIS directory
search higher up the tree.
foreach (DirectoryEntry Site in new DirectoryEntry("IIS://" +
System.Environment.MachineName + "/w3svc").Children)
{
if (String.Compare(Site.SchemaClassName, "IIsWebServer",
StringComparison.OrdinalIgnoreCase) == 0)
{
Console.WriteLine(Site.Properties["ServerComment"].Value.ToString());
Console.WriteLine(Site.Properties["LogFileDirectory"].Value.ToString());
}
}
If you start here you can get the properties of each web site. The Name of
each Site in the code above can be "1", "2", etc which enumerates the N
sites and you can then append /N/ROOT to the uri and drill down into each
site as I did in my previous code.
Now I have the log files location, I've hit another technical stumbling
block on reading the files. I'll post separately about this.
Greg