Solved

WMI query for web site description

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

17 Experts available now in Live!

Get 1:1 Help Now