Solved

WMI query for web site description

Posted on 2008-10-08
1
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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