Solved

WMI query for web site description

Posted on 2008-10-08
1
429 Views
Last Modified: 2008-10-08
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

0
Comment
Question by:yommm
1 Comment
 
LVL 1

Accepted Solution

by:
jhchoe earned 500 total points
ID: 22673198
Try this code.
Set objWMIService = GetObject("winmgmts:\\.\root\MicrosoftIISv2") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM IIsWebServerSetting") 
For Each objItem in colItems 
   MsgBox "ServerComment: " & objItem.ServerComment
Next

Open in new window

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question