I am looking for a way to find the log folder path of a certain website in IIS by its ID name, like: W3SVC1 or any other method, from inside my application. Is this possible? I tried looking up and down google and found nothing. How is this achieved?
The following code works, but only gets all of the application names/ids (like W3SVC/1), i need the actual log file path, and since they can change I don't want to use the static default log file directory as the root on this:
Function ProcessWebSite(ServiceType, SiteNumber) Set IISWebSite = getObject("IIS://localhost/" & ServiceType & "/" & SiteNumber) Set IISWebSiteRoot = getObject("IIS://localhost/" & ServiceType & "/" & SiteNumber & "/root") ProcessWebSite = IISWebSite.ServerComment Set IISWebSiteRoot = nothing Set IISWebSite = Nothing end function Function ShowSites(ServiceType, ClassName, Title) Response.write "Web Sites Description=" & "<br>" Response.write "===============================================================" & "<br>" Set IISOBJ = getObject("IIS://localhost/" & ServiceType) for each Web in IISOBJ if (Web.Class = ClassName) then Response.write Ucase(ServiceType) & "/" & Web.Name & _ Space(17-(len(Ucase(ServiceType))+1+len(Web.Name))) & " " & _ ProcessWebSite(ServiceType, Web.name) & "<br>" end if next Set IISOBj=Nothing End function Call ShowSites("w3svc", "IIsWebServer", "Web")