November 2010 (1)
August 2010 (1)
July 2010 (1)
June 2010 (3)
July 2009 (3)
June 2009 (1)
May 2009 (1)
February 2009 (1)
January 2009 (1)
November 2008 (3)
October 2008 (4)
September 2008 (9)
August 2008 (6)
July 2008 (3)
June 2008 (3)
January 2008 (1)
November 2007 (2)
October 2007 (6)
September 2007 (5)
August 2007 (22)
July 2007 (6)
June 2007 (1)
May 2007 (3)
April 2007 (27)
March 2007 (8)
February 2007 (6)
September 2006 (2)
August 2006 (4)
July 2006 (9)
June 2006 (17)
May 2006 (20)
April 2006 (12)
March 2006 (9)
February 2006 (4)
January 2006 (3)
December 2005 (2)
November 2005 (4)
October 2005 (5)
September 2005 (37)
August 2005 (83)
July 2005 (6)

Active Directory / LDAP (0)
ASP.Net (19)
Blackberry Development (4)
c# (34)
c++ (3)
Code Camp (1)
Excel (1)
Exchange (3)
Front Page 2003 (6)
FTP User Editor (4)
IIS (146)
IIS - Log Parser (7)
IIS / FTP (12)
IIS / Tools / Administration (42)
IIS / Tools / Authentication (6)
IIS / Tools / Compression (8)
IIS / Tools / Crash & Hang (12)
IIS / Tools / ISAPI Filters (17)
IIS / Tools / Log Files (17)
IIS / Tools / Scripts (28)
IIS / Tools / Security (9)
IIS / Tools / SSL (6)
IIS 7 (3)
Internet Information Server (1)
Me (Chris Crowe) (6)
MIME Types (1)
Misc (72)
Oulook Express (2)
Silverlight (1)
SQL Server (27)
SQL Server CTE (1)
Vista (15)
Vista Gadgets (8)
Visual Studio (11)
Voice over BroadBand (1)
Windows (33)
Windows Powershell (3)
Windows Sharepoint Services (0)
Windows Sharepoint Services (15)
Windows Vista (14)
Wine Cellar (1)
WMI (8)


May 2006 (20)

Reinstalling IIS on an Exchange 2000 or Exchange 2003 server

If you are running IIS on an Exchange Server 2000 or 2003 machine make sure you really think hard before you uninstall IIS - it is not a trivial process to get your exchange and IIS linked together again.

Microsoft has a KB article #320202 available here;en-us;320202 that describes the process in detail to get the system working again.

Apparently when you remove IIS you have also removed some additional configuration parameters that exchange has added to the IIS Metabase and you must follow the 6 steps below to relink the attributes when you install IIS again.

  • Back Up Data
  • Dismount the Mailbox and the Public Information Store
  • Stop Exchange Services and Remove IIS
  • Reinstall Internet Information Service and Reapply Service Packs
  • Reinstall Exchange Server
  • Restore the Original Exchange Information Store

So this is a non trivial action - just make sure you really know what you are doing prior to removing IIS and if you are going to remove IIS and follow the KB Article give yourself plenty of time...

Creating a virtual directory using System.EnterpriseServices and C#
I came across this post in the IIS Newsgroups today

I want to create virtual directory in IIS. I have a method in doing C# for doing this . The following code is supposed do my job. But It throws the following errors. I strongly feel there is something going wrong with the metabase path "IIS://localhost/W3SVC/1/Root".

Can somebody help me in finding out correct metabase path.

//Create a virtual directory

System.EnterpriseServices.Internal.IISVirtualRoot vr = new System.EnterpriseServices.Internal.IISVirtualRoot();

string sError;

vr.Create("IIS://localhost/W3SVC/1/Root",@"C:\Demos\WebServices\","WebServices",out sError);

The error it has thrown is :

System.Runtime.InteropServices.COMException (0x80070003): The system cannot find the path specified
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Add(String name, String schemaClassName)
at System.EnterpriseServices.Internal.IISVirtualRoot.Create(String RootWeb, String inPhysicalDirectory, String VirtualDirectory, String Error)

In my search to try to help this person I came across the original location of the code he used at

I never know that there was a System.EnterpriseServices.Internal.IISVirtualRoot object in .NET so I learned something along the way as well.

Note: If testing this you will need to add a reference to System.EnterpriseServices

I did some simple tests to try to reproduce the error that the user has seen. I managed to get the same error by specifying an invalid metabase path which explains the The system cannot find the path specified message.

In the code above the IIS Metabase path is specified as /W3SVC/1/Root. The digit 1 (one) in the code refers to the Web Site with an Instance ID of 1. This is always the default web site.

The way to determine what your web site instance id is; is to look at the log file name.

The Log filename contains a path such as W3SVCx where x is the web site Instance ID.

Open IIS Manager and select the web site.

Right click it and select properties and the following will be displayed.

Click on the properties button to bring up the Extended logging properties dialog.

In the highlighted area in the image above you will see the web site Instance ID.

Replace the number in the code with this number and it should work fine for you.

Get Ready for SQL Server 2005 with Microsoft E-Learning Courses.

Whether you are interested in database administration, database development, or business intelligence, you can access the E-Learning topic you want, when you want it, and learn at your own pace. Each lesson includes hands-on virtual labs and offline functionality.

In addition, you may consider taking a free Microsoft Skills Assessment to help you meet your Microsoft SQL Server 2005 training goals. You'll receive a learning roadmap with additional skills resources including instructor-led classroom training and books.

Note: The E-Learning Courses below are free for 90 days - get in there now!

For more details on all the SQL 2005 courses see

Microsoft Virtual Labs

These labs give you time as a full admin using a product on an OS fully configured for a period of 90 minutes in your web browser. You can do what you want including trashing the system completely. This is your time to try the product. Do you have the system at home or work to install these products? who carees, try the labs you can really put the product though its paces.

IIS 7.0 Virtual Labs

SQL Server 2005 Virtual Labs

+ heaps of others on Security, Sharepoint, MOM, Windows Server, ISA, SMS, Live Communication Server....

Rounded Corners Demo

The following code will allow you to create rounded corners on your HTML pages.

The output from the following HTML is like this:

You can change the colour of the background by changing the background attribute of the .bg-rounded-container class - currently set to Orange.

For a live demo click here

<style type="text/css">
.bg-rounded-container {
 BACKGROUND:  orange; 
 WIDTH: 400px; 
 POSITION: relative; 
 HEIGHT: 50px
.bg-rounded-content {
 FONT-FAMILY: Tahoma, "Arial Narrow", sans-serif;
 font-weight: bold;
 font-size: 14pt;
 text-align: center;
.bg-rounded-top-left {
 FONT-SIZE: 0.1em; 
 BACKGROUND-IMAGE: url(/images/bg-rounded-corners.png); 
 WIDTH: 7px; 
 HEIGHT: 7px
.bg-rounded-top-right {
 FONT-SIZE: 0.1em; 
 BACKGROUND-IMAGE: url(/images/bg-rounded-corners.png); 
 WIDTH: 7px; 
 HEIGHT: 7px
.bg-rounded-bottom-right {
 FONT-SIZE: 0.1em; 
 BACKGROUND-IMAGE: url(/images/bg-rounded-corners.png); 
 WIDTH: 7px; 
 HEIGHT: 7px
.bg-rounded-bottom-left {
 FONT-SIZE: 0.1em; 
 BACKGROUND-IMAGE: url(/images/bg-rounded-corners.png); 
 WIDTH: 7px; 
 HEIGHT: 7px
.bg-rounded-top-left {
 FLOAT: left
.bg-rounded-top-right {
 FLOAT: right
.bg-rounded-bottom-right {
 RIGHT: -1px; 
 BOTTOM: -1px; 
 POSITION: absolute
.bg-rounded-bottom-left {
 LEFT: 0px; 
 BOTTOM: -1px; 
 POSITION: absolute
</style type="text/css">
<div class="bg-rounded-container">      
<div class="bg-rounded-top-left"></div>      
<div class="bg-rounded-top-right"></div>      
<div class="bg-rounded-content">Rounded Corners Demo</div>      
<div class="bg-rounded-bottom-left"></div>      
<div class="bg-rounded-bottom-right"></div>    

SQL Prompt - Intellisense and Code Completion for SQL Server, VS.NET 2003+2005, Query Analyzer and others...
Intellisense for SQL Server

SQL Prompt provides Intellisense® style auto-completion for Microsoft SQL Server editors. It will tell you the exact formatting you should use for your SQL commands, while you are writing them and will therefore help you write fast, perfectly formatted SQL statements. SQL Prompt improves the productivity of all SQL script creation.

SQL Prompt simply sits behind the scenes and provides unobtrusive help when you press Ctrl-Space or when you type "." after a table/view/alias name.

Features include :

  • Table/View name completion
  • Column name completion
  • Stored procedure name completion
  • USE completion
  • JOIN/JOIN ON completion
  • Auto-uppercasing of keywords
  • Auto-popup after keywords

SQL Prompt works with the following products:

  • UltraEdit32
  • Visual Studio 2005
  • Visual Studio .NET 2003
  • Microsoft Query Analyzer
  • SQL Server 2005 Management Studio
  • SQL Server 2000 Enterprise Manager

This software has no time-bombs, no restrictions, except you must download it prior to 1st September 2006 for it to be free!

For more details and to download (requires registration)

The new official IIS 7 Site is now publically available and online

IIS 7 Virtual Labs

Do you want to play around with the latest verison of IIS 7 without having to find a machine or a setup a Virtual PC image?

The new IIS 7 site has Virtual Labs where can test IIS 7 today on Vista Beta 2 (offical release version) via a web browser for 90 minutes for free.

The virtual labs have a workbook you can download for showing you parts of the new system; one of the labs shows how to create a new Authentication module for IIS 7 so you can use any ASP.NET membership provider as the credential store for Basic Authentication.


Now you can find all Microsoft IIS technical information in a single location.

The TechCenter has a nice search interface where you can search for content based on a large number of different criteria as shown below.

You can also browse the TechCENTER using a number of different categories such as:

  • IIS 7
  • Administration & Management
  • ASP.NET Administration
  • Extensibility
  • Publishing Content
  • Security
  • Setuyp & Migration
  • Troubleshooting
  • Tuning IIS
  • Updates
  • WebFarms


A number of IIS related tools for downloads are also available in a number of categories:

  • Montioring Tools
  • IIS 7 Tools
  • Team Favorites
  • Security Tools
  • Debugging Tools
  • Administration Tools


Obviously an offical site dedicated to IIS must have a communtity forum where you should get the best support available for current versions of IIS and also the next version.

If you have joined the ASP.NET forums then you will already be a member of the IIS forums.

Expect to see answers by Microsoft exmployees and also MVP's and lots of others willing to help you with your questions and problems.


Just like everywhere else there are blogs on the new offical IIS 7 site - currently they only appear to havge the IIS team blogs and not any of the MVP blogs such as this one. I do not know if that will change but I don't mind either way but it would help with supporting others who have prompted and support their products.

IIS Web Cast Series

Just incase you are looking for WebCasts on IIS there is a nice section that displays them all.

Hint: You can also just play around with Vista in the Virtual Labs if you wanted as well since it is a full version of Vista.

Remember the URL is - nice and simple to remember - so go check it out...

More free books.....

While searching for some free books I came across these two good sites.

Microsoft and .NET books for free download


Free computer science books and lecture notes


Dissecting a C# Application: Inside SharpDevelop

Learn advanced .NET programming techniques by getting an insider's look at a complete application!

The developers who created SharpDevelop give you the inside track on application development with a guided tour of the source code for SharpDevelop. They show you the most important code features and explain how you can use these techniques in your own projects. You will gain valuable experience of building an application on this scale, learning from the decisions, mistakes, problems, and solutions that led to the current version of SharpDevelop.

You will need to register to download the PDF but it is well worth it. Total Pages 538..

Free Book - Introducing Microsoft Visual Basic 2005 for Developers

Microsoft is giving away this book either as a single download (15MB) or chapter by chapter.

Get a focused, first look at the features and capabilities in Microsoft Visual Basic 2005, Visual Studio 2005, and the .NET Framework 2.0.

If you currently work with Visual Basic 6, these authors fully understand the adoption and code migration issues you'll encounter. They'll step you through a quick primer on .NET Framework programming, offering guidance for a productive transition.

If you already work with .NET, you'll jump directly into what's new, learning how to extend your existing skills.

From the innovations in rapid application development, debugging, and deployment, to new data access, desktop, and Web programming capabilities, you get the insights and code walkthroughs you need to be productive right away.

For more details see

Team this up with Express Version of Visual Basic 2005 and you have a complete free system.

Note: The express version of Visual Basic is now free forever....

Windows PowerShell - WMI and IIS

A simple example to return all the fields in the IISWebService object on an IIS 6 computer using Windows PowerShell and the get-wmiobject cmdlet.

A simple example to return just the name fields from the IISWebServer object on an IIS 6 computer.


Windows PowerShell

Windows PowerShell is a new command-line shell and task-based scripting technology that provides comprehensive control and automation of system administration tasks.

Windows PowerShell allows Windows administrators to be more productive by providing numerous system administration utilities, consistent syntax, and improved navigation of common management data such as the registry or Windows Management Instrumentation (WMI).

Windows PowerShell also includes a scripting language which enables comprehensive automation of Windows system administration tasks. The Windows PowerShell language is intuitive and supports existing scripting investments. Exchange Server 2007 and System Center Operations Manager 2007 will be built on Windows PowerShell.

Windows Powershell has also been known under the code name Monad and is currently in Release Candiate.

Mondad is built on top of the .NET Framework version 2 and basically allows you to create scripts called cmdlets that you register with the system and then can reuse at any time.

A cmdlet is referred to by a verb and noun pair, separated by a "-":


These cmdlets can be piped together using the pipe character (same as the old DOS pipe command) |   But unlike the simple DOS pipe command you can concatinate any monad cmdlets to product interesting and very powerful results.

For the download url go to

The download is 2.2 MB for RC1 and requires that you register prior to downloading.

side note: I had problems with the Microsoft Passport logging into this site so I logged into another Microsoft Passport site and then went back to the Powershell registration url and it worked fine.

An example to find all services that are stopped on your machine

  • get-service | where-object {$_.status -eq "stopped"}

To find all services where their name contains the name “SQL“

  • get-service | where-object {$_.status -like "*SQL*"}

Now this may be very nice but how about something complex such as doing a DIR on the registry from within your script?

What about using IPConfig.exe a standard console application to display an IP Address?

Typing IPCONFIG into the Powershell returns the standard data you woud expect (something like this)

Windows IP Configuration

Ethernet adapter Wireless Network Connection:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . :
        Subnet Mask . . . . . . . . . . . :
        Default Gateway . . . . . . . . . :

Using a Powershell filter you can get the IP Address very simply by itself without the other details.

This is just touching the surface of this powerful tool. You can create functions with looping, variables, regular expressions and so much more..

A good site that has quite a few scripts is at and also the Microsoft Script Center web site has a category for Powershell Scripts at

Remember to download go to

Ever wanted to find a font just like the one used by certain publications, corporations, or ad campaigns?

Ever wanted to find a font just like the one used by certain publications, corporations, or ad campaigns?

This amazing system at can help you by allowing you to upload or to link to an image on the web and it will attempt to find you the actual font that was used to create the text.

For example I used the new IIS 7 font used on the logo for the new IIS 7 web site

Here is my example font.

The site then decoded the image into each individual letter as shown below and allowed me to specify the actual letter (it got it right so I did not need to specify anything).

I then clicked on Search and it searched it database for matching fonts.

It did not find the font used but did come up with 23 very close fonts. In the case when the system can not locate the exact font you can submit your image to their forum where very willing helpers will try to identify the font for you.

Here is an example of the first 9 that it did find.

If on the other hand the font is identified you can view your own sample text and in a font size just to make sure and will then help you to buy the font.

This is a great service and very quick and often helpful.

For more details see

The .NET Show: IIS 7.0

Shipping with Windows Vista will be the latest version of Internet Information Services (IIS), which includes a broad collection of features and capabilities that have been anxiously awaited by both developers and IT Pros. Scott Guthrie and Bill Staples describe and demo new features in IIS 7.0

This is a 1 hour 30 minute show (with 30 minutes) covering IIS 7 which was recorded on May 18th, 2006.

The technical level is 300 so we should see some good techy stuff in the video and not just marketing fluff.

The technoBabble section is the section on IIS 7.

For more details and to watch the video

Mitch Tulloch interviews IIS evangelist Brett Hill

Mitch Tulloch is the author of Windows 2000 Administration in a Nutshell, Windows Server 2003 in a Nutshell, and Windows Server Hacks.

Mitch intervies Brett Hill about the forthcoming IIS 7 product line that will be included with Windows Vista and Windows Server (“LongHorn“)

For the full article see

IIS 7 - New Site dedicated to IIS 7

Microsoft will be launching a new web site dedicated to IIS 7 on Tuesday 23rd May 2006 (note currently password protected) to coincide with the impending release of Windows Vista & Windows Server ("Longhorn") Beta 2. 

Some of the features of the new site:

  • The first true detailed learning on IIS 7.0 (40+ articles, videos, etc.)
  • IIS Product Team blogs
  • Community focused Forums similar to ASP.NET & MSDN
  • Learning Portal called "TechCENTER"
  • Real-live Virtual Labs so you can practice IIS 7.0 at your pace, online, without ever installing bits

Some of the features of the new IIS 7 product:

  • Minimize patching and security risks with fine grained control over Web server footprint
  • Implement powerful Web solutions rapidly with a new extensibility framework
  • Go to market faster with simplified deployment and configuration of applications
  • Reduce administrative costs by managing Web infrastructure more efficiently
  • Reduce Web site downtime by quickly resolving faulty applications

The site url is  (remember not until Tuesday 23rd May 2006)

Parser Error Message: Unrecognized configuration section 'connectionStrings'
If you receive the error below then it means that your web site or virtual directory is configured to run with the wrong version of  the .NET Framework.

Server Error in '/MSDN' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'connectionStrings'

Source Error:

Line 12: 		<add key="ConnectionString" value="User ID=MSDN;Password=$MSDN$;Initial Catalog=MSDN;Data"/>
Line 13: 	</appSettings>
Line 14: 	<connectionStrings/>
Line 15: 	<system.web>
Line 16:     <pages theme="MSDN"></pages>

Source File: D:\Inetpub\websites\IS\MSDN\web.config    Line: 14

Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300

Microsoft Atlas Control Extender - Focus

What it does

The Focus extender will allow you to set the input focus to a particular control on your web form. I know that with ASP.NET v2 you can use the DefaultFocus attribute of the

tag to set the focus but that does not work well with Master Pages.

How to use it.

In your ASP.NET source page you need to register a tag prefix to the DLL as shown below.

<%@ Register Assembly="Focus" Namespace="Focus" TagPrefix="trmb" %>

You then need to add the tags to the page to control the focus.

<trmb:FocusExtender ID="Focusextender1" runat="server">
    <trmb:FocusProperties TargetControlID="txtPN" />

There is really only one property which you need to set which is the TargetControlID. You simply set this to the ID of the server control to set the focus to.

The source code

The source is made up of 4 primary files - the easiest way to generate source code for an Atlas Control Extender is to use the Add - New Project dialog and select the "Atlas" control project

Creating a project using the "Atlas" control project template will create 4 files for you:

  • [ProjectName]Behavior.js
  • [ProjectName]Designer.cs
  • [ProjectName]Extender.cs
  • [ProjectName]Properties.cs

Note: If you do not see the "Atlas" control project listed then you need to install the "Atlas Control Extender" templates.

Note that the "Atlas Control Extender" is for building extenders and controls, not web sites, and therefore does not work with
Visual Web Developer - it is for use with Visual C#, Visual Basic, or Visual Studio

  • In the folder where you installed the "Atlas" Control Toolkit package, you will find a folder called "AtlasControlExtender" with a file called "AtlasControlExtender.vsi" inside it - double-click AtlasControlExtender.vsi to install it
  • Choose which templates you would like to install (it is recommended to install all templates), then click "Next", then "Finish"
  • You have now installed the templates are ready to create your "Atlas" Extenders!


The changes made to this file have been to remove some features that we did not need to keep the file size smaller.

The code in bold is all that we have to implement to get the control to focus.

Focus.FocusBehavior = function() {
    this.initialize = function() {
        Focus.FocusBehavior.callBaseMethod(this, 'initialize');
var e = this.control.element;
if (e != null)
Focus.FocusBehavior.registerSealedClass('Focus.FocusBehavior', Microsoft.AtlasControlExtender.BehaviorBase);
Sys.TypeDescriptor.addType('focus', 'FocusBehavior', Focus.FocusBehavior);


No changes were made to this file

using System.Web.UI.WebControls;
using System.Web.UI;
using Microsoft.AtlasControlExtender;
using Microsoft.AtlasControlExtender.Design;
namespace Focus
    class FocusDesigner : ExtenderControlBaseDesigner


No changes were made to this file

using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using System.ComponentModel.Design;
using Microsoft.AtlasControlExtender;
#region Assembly Resource Attribute
[assembly: System.Web.UI.WebResource("Focus.FocusBehavior.js", "text/javascript")]

namespace Focus
    [ClientScriptResource("Focus", "FocusBehavior", "Focus.FocusBehavior.js")]
    public class FocusExtender : ExtenderControlBase


The changes made to this file was to basically remove everything and leave it as below since we did not need any custom properties defined.

using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using Microsoft.AtlasControlExtender;
namespace Focus
    public class FocusProperties : TargetControlPropertiesBase

Locating Unused Log File Directories

When running IIS on a server edition you can create multiple web sites and over time you may add and remove sites. When you do this the Log Files are still retained

The following script can be used to find unused log file directories that are no longer associated with any IIS Web Sites - it does not delete them just displays them.

Example Output


  • cscript LocateUnusedLogFileDirectories.VBS

Source Code

You can download the source code by clicking here.

Option Explicit

dim LogFileDirectory
dim Folders()
dim Sites()
dim Valid()

function EnumerateFolders()
 Dim FSO, Dir, File, Index

 set FSO = createobject("Scripting.FileSystemObject")
 set Dir = fso.GetFolder(LogFileDirectory)

 redim Folders(Dir.SubFolders.Count)
 redim Valid(Dir.SubFolders.Count)

 Index =0

 for each File in Dir.SubFolders
  if (left(File.Name,5) = "W3SVC") then
   Folders(Index) = File.Name
   Valid(Index) = false
   Index = Index+1
  end if

 redim Preserve Folders(Index-1)
 redim Preserve Valid(Index-1)

 set Dir = Nothing
 set FSO = Nothing
end function

function DisplayFolders()
 dim Folder, Index, Bad

 Bad = 0
 for Index= 0 to UBound(Folders)
  if (Valid(Index) = false) then
   Bad = Bad + 1
   WScript.echo LogFileDirectory & "\" & Folders(Index)
  end if
 if (Bad = 0) then
  WScript.echo "There are no Log directories found that are not associated with IIS"
  WScript.echo ""
  WScript.echo Bad & " directories were found..."
 end if
end function

function EnumerateSites()
 Dim IISObj, Web, Index

 Index = 0 
 Set IISOBJ = getObject("IIS://localhost/w3svc")
 for each Web in IISOBJ
  if (Web.Class = "IIsWebServer") then 
    Index = Index + 1
    redim Preserve Sites(Index)
    Sites(Index) = "W3SVC" & Web.Name 
  end if
 Set IISOBj=Nothing
end function

Function ProcessFolders()
 dim Folder, Index, fIndex

 for Index = 0 to UBound(Sites) 
  for fIndex= 0 to UBound(Folders) 
   if (Sites(Index) = Folders(fIndex)) then
    Valid(fIndex) = true
   end if
end Function

function GetDefaultLogFolderPath
 Dim IISObj

 Set IISOBJ = getObject("IIS://localhost/w3svc")
 LogFileDirectory =  IISObj.LogFileDirectory
 Set IISOBj = Nothing
end function

function WriteHeader
 WScript.Echo "The following directories are no longer associated with any IIS Web Sites."
 WScript.Echo ""
end function

call WriteHeader
call GetDefaultLogFolderPath
call EnumerateFolders
call EnumerateSites
call ProcessFolders
call DisplayFolders

IIS 6 - Web Site Instance IDs - seemingly random but they are not!

On IIS 6.0 you will find that when you create web sites that their log files are created with seemingly random numbers. In previous versions of IIS the Instance IDs as they are called were sequentially numbered.

The first "Default Web Site" has a log file directory of W3SVC1 but any new sites you create may end up as follows (or something similar)

  • W3SVC1240841244
  • W3SVC1289352529
  • W3SVC147076792
  • W3SVC1527186048
  • W3SVC1566259604
  • W3SVC1710104836

I have written a script that you can use to display all the web sites and their associated Instance Ids - the output similar to the following.

Web Sites                    Description
W3SVC/1                   Default Web Site
W3SVC/1036328378 WebSite1
W3SVC/1816184000 WebSite2
W3SVC/1867813904 WebSite3
W3SVC/568530179   WebSite4
W3SVC/719499532   WebSite5
W3SVC/669732006   WebSite6

See for the script.

Something I only learned recently was that the Instance Ids can be made sequential again by editing the registry and they are not random at all.

Changing the behaviour to the same as previous IIS versions

Remember : Editing the registry is a risk you take on your own shoulders.

To do this:

  1. Click Start, click Run. In the Open box, type regedit, and then click OK.
  2. In Registry Editor, locate the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetMgr\Parameters
  3. Click the Parameters key. On the Edit menu, click New Dword Value.
  4. Type IncrementalSiteIDCreation for the name.
  5. Double-click the name of the new value.
  6. Change Value Data to 1, and then click OK.
  7. To enable the change, restart the IIS services.

Note: When you remotely administer another IIS server, the value of the registry key of the local server is used to determine how the site identification number is generated on the remote server.

Why was it changed?

The reason that Instance ID were changed was that if you are running a Web Farm with multiple physical IIS servers and create a web site on each server with the same description all of the web sites will have the same Instance ID.

Basically if you create a new web site in IIS 6 and then delete the web site and create it again it will be created with the same Instance ID. So if you have multiple physical web servers for a particular web application you can read the log files from the same W3SVCx where x is the instance ID.

I created a web site with a description of XYZ and it produced the Instance ID of 906768 so my log file directory ended up as W3SVC906768

I then deleted this web site and the associated Log File Directory and repeated the exercise.

It indeed did create the same Instance ID of 90768

The following table shows some descriptions and Instance IDs

Description Instance ID Comment
A 66 ASCII character for B not A
B 67 ASCII character for C not B
AA 6631 No idea why 31 appears
AB 6632 No idea why 32 appears
AAA 669696 No idea why 96 appears