Click here to Skip to main content
Licence 
First Posted 25 May 2005
Views 45,073
Bookmarked 30 times

Managing virtual directories on multiple IIS sites and servers

By | 25 May 2005 | Article
A simple tool to check virtual directories settings on multiple web sites and web servers.

Introduction

Did you ever face the need of maintaining a family of similar web applications, eventually hosted on multiple web servers in a farm? If yes, for sure you must have discovered how uncomfortable the standard IIS management user interface (the "IIS Manager" MMC) can be for this kind of tasks. In fact, its classical "tree on the left / details on the right" structure is not suitable for the management of different web sites "in parallel", because it forces the user to concentrate each time on a specific node or sub tree of the hierarchical structure.

In my experience, I felt the lack, in "IIS Manager", of such a cross-application and cross-server transversal management when dealing with virtual directories of a web site developed in nine languages and hosted on a 10 web servers farm. Then, I wrote a simple tool (named Virtual Directory Viewer) useful to check virtual directory settings on multiple web sites and web servers, through a tabular "synoptic view" obtained programmatically inspecting the IIS metabase.

The Virtual Directory Viewer

Basically, the behavior of the Virtual Directory Viewer is very simple:

  • at the beginning, you have to configure the list of the web sites and of the IIS servers you need to inspect;
  • then, the tool collects data about virtual directories defined under the web sites specified by you;
  • the collected data are presented in the form of a matrix: each column represents a web site, each row represents a virtual directory, each cell holds the physical path to which the specific virtual directory is pointing to;
  • the shown matrix can be easily transposed and/or sorted (for a more comfortable reading), and it can be saved in an XML file for future reference or post-processing.

Using the tool

First of all, you need to configure the list of the web sites and of the IIS servers you need to inspect. To do this, on the main form, click on the "Web sites.." button. The "Web site Chooser" dialog box will appear:

Inside the "Web site Chooser" form, you can:

  • manually edit the list of the web sites you want to check, by entering the full metabase path of each of them;
  • automatically retrieve the web sites list, by clicking on the "Reload web sites list" button (the Virtual Directory Viewer will populate the list with all the web sites hosted on the servers specified in the "Server Chooser" - see below);
  • select/deselect the web sites to include in the actual virtual directory check.

The "Web site Chooser" form also allows simple query filtering and multiple selection/de-selection on the listed entries, to make the setup easier. The "Servers..." button lets you access the "Server Chooser" form, another configuration form (very similar to the previously described one) where you have to specify the web servers included in the virtual directory check.

This form offers similar filtering and selection facilities, but in the case of the web server list the editing is manual. The Virtual Directory Viewer uses two DataTable objects to hold both the list of the web servers and the list of the web sites to be inspected. (The latter eventually obtained by the former, as described.) These lists are automatically stored in an XML file to persist your working session environment.

After the setup of the web servers / web sites lists, run the automatic inspection of the virtual directory by clicking the "Load data" button on the main form. On the status bar, you will see the web site currently enumerated during the scan operation.

After the data collection, the resulting matrix - as already stated - can be read, sorted, transposed, exported in XML, copied to clipboard etc. (for pasting it, for example, in a Microsoft Excel sheet).

Points of interest

The core of the Virtual Directory Viewer tool uses the System.DirectoryServices .NET namespace to manage IIS metabase information. I have used the methods and properties of the DirectoryEntry class. Other points of interest include DataTable and DataSet manipulation and serialization.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Alberto Venditti

Technical Lead

Italy Italy

Member

I was born in 1970.
 
I studied Electronic Engineering (graduated in 1997).
 
Subsequently, I passed some Microsoft exams, and currently I'm certified as:
MCP, MCT, MCDBA, MCSD, MCAD, MCSD for .NET (early achiever).
 
My first computer experience dates back to early 80s, with a Sinclair ZX81.
From that time on, as many "friends" say, my IT-illness has increased year by year.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThank You - Great Article Pinmembernospam1961-codeproject@yahoo.com7:34 25 Jul '08  
GeneralReally Maintaining multiple IIS sites and servers (IIS 6 only) PinmemberS E E B17:08 5 Sep '05  
Hi Alberto,
 
I don't have any complains but only praises to contribute. you see, after seeing your example I am now able to develop an in-house vb.Net Apps Deployment and Tracking System.
 
What I had in mind was to use your example in conjuction with adsutil.vbs, "adsutil.vbs enum_all" and iisback.vbs, sentmail through a series of command line scripts to facilitate the need to deploy apps to be used by an Network Administrator without needing Developer to access the Production environment.
 
Great work mate!
 
Cheers

 
Sebastian Dieu (sebastian.dieu@asc.com.au)
Generalpath value PinmemberAshley van Gerven21:53 8 Aug '05  
GeneralRe: path value PinmemberAlberto Venditti0:08 9 Aug '05  
GeneralLOL PinmemberChristian Graus19:46 25 May '05  
GeneralRe: LOL PinmemberAlberto Venditti23:17 25 May '05  
GeneralRe: LOL PinmemberChristian Graus11:36 26 May '05  
QuestionSource Code !? PinmemberShahrokh Shirzad19:32 25 May '05  
AnswerRe: Source Code !? PinmemberAlberto Venditti23:07 25 May '05  
GeneralRe: Source Code !? PinmemberJason Vetter5:57 24 Sep '06  
GeneralRe: Source Code !? PinmemberAlberto Venditti6:46 24 Sep '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120529.1 | Last Updated 25 May 2005
Article Copyright 2005 by Alberto Venditti
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid