I have a vbscript I wrote several years ago that lists all the sites on an IIS server with various attributes. I have been trying to modify this to also list the path(s) of each virtual directory, but neither "application" nor "applicationcollection" seem to be a child element of the site element. I have looked through the MS documentation but their example code only shows adding applications, not listing them.
This is what I have so far:
Set adminManager = Wscript.createObject("Microsoft.ApplicationHost.WritableAdminManager") adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST" Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST") Set sitesCollection = sitesSection.Collection For siteCount = 0 To CInt(sitesCollection.Count)-1 Set siteElement = sitesCollection(siteCount) 'Various other bits here.... 'Then this line doesn't work. I can't figure out how to reference the application Set appCollection = siteElement.ChildElements.Item("applicationCollection").Collection Next
Could someone post some example vbscript for listing the virtual directories of the site?