Solved

WMI query for web site description

Posted on 2008-10-08
1
421 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now