IIS
  Home arrow IIS arrow Page 3 - IIS 6.0, Getting Information Using WMI
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
IIS

IIS 6.0, Getting Information Using WMI
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 31
    2005-10-12

    Table of Contents:
  • IIS 6.0, Getting Information Using WMI
  • What is new in IIS 6.0?
  • Can we retrieve IIS information using WMI?
  • Playing with Virtual directories and Web applications
  • How about SMTP, POP3, FTP services in IIS?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    IIS 6.0, Getting Information Using WMI - Can we retrieve IIS information using WMI?
    (Page 3 of 5 )

    Why not? As WMI is also meant for system administration, obviously it boasts very good support for IIS.  To find more information about WMI, you can refer to my previous articles at this website.  To work with IIS and WMI together, we need to work with the classes existing in the “root\MicrosoftIISv2” namespace.  This is a very important point to remember when working with WMI for IIS.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftIISv2")
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM IIsWebInfo",,48)
    For Each objItem in colItems
        Wscript.Echo objItem. MajorIIsVersionNumber & " -->: " & objItem. MinorIIsVersionNumber
    Next

    Within the above example, I am working with a class “IIsWebInfo” available in the “\\root\MicrosoftIISv2” namespace.  “IIsWebInfo” mainly contains all information regarding version, status, install date, and so on.

    Can we know, whether IIS is running or not using WMI? Certainly.  Not only that, we can even retrieve further information about IIS (if it is still running) by using the following script:

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftIISv2")
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM IIsWebService",,48)
    For Each objItem in colItems
        Wscript.Echo "DisplayName: " & objItem.DisplayName
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "PathName: " & objItem.PathName
        Wscript.Echo "Started: " & objItem.Started
        Wscript.Echo "State: " & objItem.State
        Wscript.Echo "Status: " & objItem.Status
        Wscript.Echo "SystemName: " & objItem.SystemName
    Next

    Within the above example, I am working with a class “IIsWebService” available in the “\\root\MicrosoftIISv2” namespace.  “IIsWebService” gives more in-depth information than “IIsWebInfo”.

    More IIS Articles
    More By Jagadish Chaterjee


       · Hey guys, the power of WMI with IIS6 is here...have some good suggetions?...do not...
     

    IIS ARTICLES

    - Retrieving IIS information using ASP.NET 2.0
    - IIS 6.0, Getting Information Using WMI
    - The Importance of a Domain
    - Implementing a PKI, Part II: Configuring IIS...
    - Creating Test and Production Sites with Only...
    - Authentication and Authorization
    - Beefing Up IIS: 10 Tips From A Former Solari...
    - An Introduction To ISAPI
    - Secure Your Web Server With SSL
    - Introduction to HTML and ASP
    - Instructions to help in Designing your own C...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway