Link to home
Start Free TrialLog in
Avatar of yommm
yommmFlag for United States of America

asked on

WMI query for web site description

Hi!


I need some VB code to be able to extract from my IIS metabase the web site descriptions. Currently I am using the IIsWebVirtualDirSetting class. I can't seem to find the website description property. The end goal is to iterate trough all my sites on the local server and find all the web site descriptions AS DISPLAYED IN THE IIS WEB SITE PROPERTIES, WEB SITE TAB, DESCRIPTION field.

Thanks!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'hourglass
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
 
        Dim network As Object
        Dim sw As New StreamWriter(txtPath.Text)
        blnStop = False
        network = CreateObject("WScript.Network")
 
 
        'app pool plus housekeeping
        Dim wmiService As Object, strComputer As String, locatorObj As Object
        strComputer = "."
 
        locatorObj = CreateObject("WbemScripting.SWbemLocator")
        wmiService = locatorObj.ConnectServer(strComputer, "root/MicrosoftIISv2")
 
        Dim applicationPools As Object
 
        applicationPools = wmiService.ExecQuery("Select * From IIsApplicationPool " & _
            "Where Name LIKE 'W3SVC/AppPools/%'")
 
 
 
        'Sites
        Dim wmiSites As Object
 
        wmiSites = wmiService.ExecQuery("SELECT * FROM IIsWebVirtualDirSetting") ', , 48)
 
        Dim objItem As Object
        For Each objItem In wmiSites
            Debug.Print(objItem.AppFriendlyName & " = ")
        Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jhchoe
jhchoe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial