I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this
code, trying to get a list of all defined websites, and write their name to
console, but it does not seem to work, would appreciate any pointers:
-----------
Try
Dim doc As New XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode
'Load the Xml file
'doc.Load("c:\windows\system32\inetsrv\metabase.xm l")
'Get the list of name nodes
nodelist = doc.SelectNodes("/MBProperty/IIsWebServer")
'Loop through the nodes
For Each node In nodelist
Dim siteName =
node.Attributes.GetNamedItem("ServerComment").Valu e
Console.WriteLine("Site: " & siteName)
Next
Catch errorVariable As Exception
'Error trapping
Console.Write(errorVariable.ToString())
End Try
-----------
Here's a sample metabase.xml file:
http://www.winnetmag.com/Files/11/22281/22281.zip