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)
HTML / CSS / DHTML (8)
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)
IIS / Tools / Administration (42) blog.crowe.co.nz.Models.Category

IIS / Tools / Administration

Starting and Stopping a Web Site And Application Pool

I had a request last week for the following:

I'm trying to do the following:

  1. Stop a IIS website
  2. Stop an App Pool
  3. Start the App Pool
  4. Start the Website

From what I can see here, I can use the example for the "starting an application pool" for the steps 2 & 3.

I have found that you can use iisweb.vbs to do steps 1 & 4.

 But how link them in the order above?

 Hope you can give me some pointers

 

The following code sample in VBScript allows you to do that with the following points of interest.

  • The Default Web Site is assumed - WebSiteID = 1, you can change this to any other web site by changing the ID with the ID of the other web site. There is a script called FindWeb.VBS or you can look at the log folder name and get the web site id from that - see http://blog.crowe.co.nz/archive/2007/08/04/IIS-Web-Site-Identifiers.aspx
  • There is only 1 site using the AppPool - well not technically true, if you run this and there is more than one web site using the app pool then it will be down while the app pool restarts.

Here is the code, save to StopAndStartSiteAndAppPool.VBS file and then run in a CMD.EXE prompt using the following syntax:

cscript StopAndStartSiteAndAppPool.VBS

 

Option Explicit

Dim WebSiteID, objWebSite, ObjAppPool

WebSiteID = "1"
Set objWebSite = GetObject("IIS://localhost/W3SVC/" & WebSiteID)
WScript.Echo "Stopping Web Site : " & objWebSite.ServerComment \
objWebSite.Stop()

wscript.echo "Stopping Application Pool : " & objWebSite.AppPoolID
Set objAppPool = GetObject("IIS://localhost/W3SVC/AppPools/" & objWebSite.AppPoolID)
objAppPool.Stop()

wscript.echo "Starting Application Pool : " & objWebSite.AppPoolID
objAppPool.Start()

WScript.Echo "Starting Web Site : " & objWebSite.ServerComment
objWebSite.Start()

You can also view/save the script from here.


Downloading Microsoft Vista gadgets on Windows 2003 IIS 6

When you try to download a Microsoft Vista Gadget on IIS 6 you will by default get a 404 error if you have not configured a mime type for .gadget

The correct mime type is:

Extension  :  .gadget
Mimetype  :  application/x-windows-gadget

 

Note: There is a “.” before the gadget above in the extension


Microsoft releases a new download center for IIS (everything in one place)

DownloadCENTER for IIS.net has been released! 

The DownloadCENTER at IIS.net, is a community hotspot for discovering, sharing, reviewing and promoting IIS-related solutions in a single place.  Dozens of existing downloads, for all versions of IIS – both from Microsoft and the community – are already available in DownloadCENTER today. 

This new feature of IIS.net is particularly relevant with the release of IIS7 in Windows Vista.  The latest release of Microsoft’s Web server has a completely modular architecture which features over forty pluggable components that can be easily added, removed or even replaced with custom implementations. 

This powerful extensibility support is available to both .NET and C/C++ developers.  In the future, DownloadCENTER is expected to house a large number of IIS7 extensions submitted by not only the IIS team but the developers and partner ISVs of the IIS community as well.

To learn more about the DownloadCenter, read IIS Product Unit Manager, Bill Staples’ blog post about it or check it out yourself today!

 


VBScript - Check if multiple version of the .NET framework are assigned to an application pool

This code will allow you to check if there are IIS applications which are configured to use multiple version of the .NET framework.

The code enumerates all the Application Pools and then find all of the applications in that pool. It then checks for the version of the .NET framework which handles the .ASPX file extension.

It saves the unique versions of the .NET Framework found and if it finds multiple versions installed will list all of the applications using that Application Poll and display the path and the version being used. This will allow you to find a potential problem which could be hard to track down normally.

Calling Usage 

cscript CheckForMultipleVersionsOfDotNetFramework.vbs

Example Output

AppPool #1
No applications using this pool!

DefaultAppPool

 Warning multiple version of the .NET framework detected!

 Found references to v1.1.4322
 Found references to v2.0.50727

 //localhost/W3SVC/1/ROO                                           - v1.1.4322
 //localhost/W3SVC/1198258389/ROO                         - v1.1.4322
 //localhost/W3SVC/1280263431/ROO                         - v1.1.4322
 //localhost/W3SVC/1388032739/ROO                         - v1.1.4322
 //localhost/W3SVC/1849151055/ROO                         - v1.1.4322
 //localhost/W3SVC/1957176745/ROO                         - v1.1.4322
 //localhost/W3SVC/4/ROO                                           - v1.1.4322
 //localhost/W3SVC/415889539/ROO                           - v1.1.4322
 //localhost/W3SVC/1/ROOT/Monito                            - v2.0.50727
 //localhost/W3SVC/1/ROOT/Monitorin                        - v1.1.4322
 //localhost/W3SVC/1/ROOT/NetTracke                       - v1.1.4322

ExchangeApplicationPool
Found references to v1.1.4322

ExchangeMobileBrowseApplicationPool
Found references to v1.1.4322

MSSharePointAppPool
Found references to v1.1.4322

MyAppPool1
No applications using this pool!

Source Code

You can download the source code here.

option explicit
dim AppsInPool, objAppPool, index, IISObj, IISPath, Version, pos
Dim Versions(), objAppPools
function FindASPXScriptMapVersion(ScriptMaps)
 Dim pos, ScriptMap
 for pos = lbound(ScriptMaps) to UBOund(ScriptMaps)
   ScriptMap = lcase(ScriptMaps(POS))
   if (left(ScriptMap, 5) = ".aspx") then
    FindASPXScriptMapVersion = mid(ScriptMap, 42)
    FindASPXScriptMapVersion = left(FindASPXScriptMapVersion, _
     instr(FindASPXScriptMapVersion, "\")-1)
    exit function
   end if
 next 
 FindASPXScriptMapVersion = ""
end function
function AddVersion(Version, Path)
 dim Found, pos
 Found = false
 for pos = lbound(Versions) to UBound(Versions)-1
  if (Versions(pos) = Version) then
   Found = true
  end if
 next
 if (Found = false) then
  redim preserve Versions(ubound(Versions)+1)
  Versions(ubound(Versions)-1)= Version
 end if
end function
Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
for each objAppPool in objAppPools
 Redim Versions(0)
 Set objAppPool = GetObject("IIS://localhost/W3SVC/AppPools/" & objAppPool.Name )
 WScript.echo objAppPool.Name 
 AppsInPool= objAppPool.EnumAppsInPool()
 if (ubound(AppsInPool) = -1) then
  WScript.echo vbtab  & "No applications using this pool!"
 else
  for index = lbound(AppsInPool) to UBound(AppsInPool)
   IISPath = AppsInPool(index)
   IISPath = "IIS://localhost/" & mid(IISPath,5, len(IISPath)-5)
   set IISObj = GetObject(IISPath)
   Version = FindASPXScriptMapVersion(IISObj.ScriptMaps)
   call AddVersion(Version, mid(IISPath,5, len(IISPath)-5))
  next
  if (ubound(Versions)> 1) then
   WScript.Echo vbcrlf & vbtab & _
    "Warning multiple version of the .NET framework detected!" & vbcrlf
   
   for pos = lbound(Versions) to ubound(Versions)-1
    WScript.echo vbtab & "Found references to " &  Versions(pos) 
   next
   WScript.echo ""
   for index = lbound(AppsInPool) to UBound(AppsInPool)
    IISPath = AppsInPool(index)
    IISPath = "IIS://localhost/" & mid(IISPath,5, len(IISPath)-5)
    set IISObj = GetObject(IISPath)
    Version = FindASPXScriptMapVersion(IISObj.ScriptMaps)
    WScript.echo vbtab & mid(IISPath,5, len(IISPath)-5) & _
     space(70 - len(IISpath)) & " - " & Version
   next
  else
   for pos = lbound(Versions) to ubound(Versions)-1
    WScript.echo vbtab & "Found references to " &  Versions(pos) 
   next  
  end if
 end if
 WScript.echo ""
next

IISLogsLite 2.0

Steve Schofield ( IIS MVP ) contact me to say that he has released a new version of his IISLogsLite product. The IISLogsLite product is now at version 2 and this product will help administrators handle their IIS Log files.

This is a free product and has more functionality than the previous version of IISLogsLite.

His goal with IISLogsLite 2.0 is to meet most administrators log archiving needs by effectively managing all log files related to Microsoft Internet Information Server 5.0 and 6.0. IISLogsLite 2.0 offers the ability to ZIP files and optionally delete the original log file. 

For more details and to download this free version visit:
http://iislogs.com/help/configure_iislogs_lite_version20.htm


IIS 6 - Creating an application and setting the application pool using ADSI
I received a request from visitor to my blog on how to set an application pool to a new folder he created.

"

I have a small web server running IIS 6 and I host small sites for friends and family all under one domain. To keep them separate I put each of their sites into a subfolder and drop it into different pools.

To date I've been doing this manually.  I've been trying to get my mind wrapped around this ADSI stuff to automate this process a bit but I'm coming up short.

Here's what I do now.. if you have a few moments can you tell me how I might go about automating this process?

  1. I make a subfolder (call it Test) in the root of my website.
  2. I go into IIS Manager, expand the website, then right click on Test / Properties.
  3. I click Create to make it into an application.
  4. I change the application pool from Default to "familypool" then Apply.
"

 

The following code will allow you to create an application and assign the application pool "familypool" to the new directory. Note the application pool “familypool“ must already have been created.

option explicit

dim IIsWebVDirObj
dim IIsWebVDirRootObj
dim NewFolderName

NewFolderName = "Test"

const CreateNewApplicationPool = true
const UseExistingApplicationPool = false


' Create the Metabase entry
Set IIsWebVDirRootObj = GetObject("IIS://LocalHost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebDirectory", NewFolderName)

IIsWebVDirObj.AppCreate3 2, " familypool", UseExistingApplicationPool
IIsWebVDirObj.AppFriendlyName = "My App Friendly Name"
IIsWebVDirObj.SetInfo

 

In the code above we have made some assumptions:

  • The web site we are assigning it to is the default web site. This has an instance ID of 1.
  • The IISWebDirectory does not exist in the Metabase. If it does it will cause an error as would be the case if you run the code twice.

In the case of the 2nd assumption above we would need to change the code from

Set IIsWebVDirRootObj = GetObject("IIS://LocalHost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebDirectory", NewFolderName)

to

' Load the Metabase entry if it does exist
Set IIsWebVDirObj = GetObject("IIS://localhost/W3SVC/1/Root/" & NewFolderName)
 


CurrPorts v1.09 - View Opened TCP/IP ports / connections
CurrPorts displays the list of all currently opened TCP/IP and UDP ports on your local computer. For each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it.

In addition, CurrPorts allows you to close unwanted TCP connections, kill the process that opened the ports, and save the TCP/UDP ports information to HTML file , XML file, or to tab-delimited text file.

CurrPorts also automatically mark with pink color suspicious TCP/UDP ports owned by unidentified applications (Applications without version information and icons)

For more details and to download (in multiple languages) see http://www.nirsoft.net/utils/cports.html


IIS 6 Application Pools and ADSI

An application pool provides you with a way of isolating Web sites and Directories from each other even though they are being hosted on a common server. Each application pool is given its own set of server resources and can be configured with different identities. That way, if a Web site crashes, it won’t effect sites in other application pools.

A example of this is a Web site which has a memory leak. If all of the Web sites hosted on a particular server were to share the system resources as was the case with IIS 5.1 and earlier and one of the Web sites had a memory leak, it could potentially take memory away from the other hosted sites.

If the leaky site were in its own application pool though, the memory leak would not effect any other site because each application pool has its own server resources including memory.

On earlier versions of IIS you could only configure your sites to run either Low ( In Process ) with the IIS Engine, Medium ( Pooled ) where all applications shared a pool of memory, and High (Out Of Process). The problem with this is that a bad application could depending on the isolation level take down the IIS server, or all other sites in the Medium ( Pooled ) model.

Each application pool can be recycled based on a memory limit, the time of day, a number of requests or just after a period of time. Each application pool can also run with its own identity which can be either Local System, Local Service, Network Service or a custom credential.

Application pools are available only when IIS is running in worker process isolation mode (this is the default). If you are running IIS in IIS 5 isolation mode, then the application pools will not be accessible to you.

There is only one application pool by default called DefaultAppPool. When you create new Web sites, the newly created sites by default will use the DefaultAppPool unless you reconfigure the site after it is created. IIS does not automatically create a separate application pool for each Web site.

Note: If you are running ASP.NET 1.1 and 2.0 then they must run in two different application pools as you can only load one version of the .NET framework into an application pool.

Below are a number of very simple scripts that you could use to view / add and edit application pools.

Note: Application Pools are only supported on IIS 6 and later.

Enumerating Application Pools

This simple script will simply display the name of each application pool on the local server.

option explicit

dim objAppPools, objAppPool

Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
for each objAppPool in objAppPools
	WScript.echo objAppPool.Name 
next

 

Enumerating Applications in an Application Pool

This script will display the web sites / directories that are using the DefaultAppPool

option explicit

dim Applications, objAppPool, index

Set objAppPool = GetObject("IIS://localhost/W3SVC/AppPools/DefaultAppPool")
WScript.echo objAppPool.Name 

Applications = objAppPool.EnumAppsInPool()
for index = 0 to UBound(Applications)
	WScript.echo "   " & Applications(index)
next

 

Enumerating Application Pool Properties

This script will display all properties of an application pool by looking at the Schema object for an Application Pool.

option explicit

dim Applications, objAppPools, objAppPool, index, IIsSchemaObject
dim PropertyName, IIsAppPoolObject, ValueList

set IIsSchemaObject = GetObject("IIS://localhost/schema/IIsApplicationPool")
set IIsAppPoolObject = GetObject("IIS://localhost/W3SVC/AppPools/DefaultAppPool")

on error resume next

For Each PropertyName In IIsSchemaObject.MandatoryProperties
	WScript.echo PropertyName
next

For Each PropertyName In IIsSchemaObject.OptionalProperties
	WScript.echo PropertyName
	ValueList = IIsAppPoolObject.Get(PropertyName)
	if (isArray(ValueList) = true) then
		for index = lbound(ValueList) to ubound(ValueList)
			WScript.echo " " & index & " - " & ValueList(index)
		next
	else
		WScript.echo " " & ValueList
	end if
next

 

Enumerating the Periodic Recycling of all Application Pools

This script will display the recycling settings of all application pools. You may find that your application stops briefly and that could be caused by the application pool being recycled every 1740 minutes ( every 29 hours) which is the default.

option explicit

dim objAppPools, objAppPool, Schedule

Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
for each objAppPool in objAppPools
	WScript.echo objAppPool.Name
	WScript.echo "  Restart Time           : " & objAppPool.PeriodicRestartTime & " seconds"
	WScript.echo "  Restart Requests       : " & objAppPool.PeriodicRestartRequests
	WScript.echo "  Restart Memory         : " & objAppPool.PeriodicRestartMemory
	WScript.echo "  Restart Private Memory : " & objAppPool.PeriodicRestartPrivateMemory
	WScript.echo "  Restart Requests       : " & objAppPool.PeriodicRestartRequests
	for each Schedule in objAppPool.PeriodicRestartSchedule
		WScript.echo "  Restart At             : " & Schedule
	next
	WScript.echo
next

 

Creating an Application Pool

This script will create a new application pool using the defaults.

strAppPool = "MyAppPool1"
Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
Set objAppPool = objAppPools.Create("IIsApplicationPool", strAppPool)
objAppPool.SetInfo

 

Creating an Application Pool to run with a specific identity

This script will create a new application pool to run as a custom identity. This custom identity could be a local or domain account. You will need to add the user account into the IIS_WPG group on the IIS server. This is because this group has been assigned permissions that the application pool will need to run properly.

strAppPool = "MyAppPool2"
Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
Set objAppPool = objAppPools.Create("IIsApplicationPool", strAppPool)

' 0 = Local System
' 1 = Local Service
' 2 = Network Service
' 3 = Custom Identity -> also set WAMUserName and WAMUserPass
objAppPool.AppPoolIdentityType = 3

' Note: WamUserName must be added to the IIS_WPG group to have correct security rights
objAppPool.WAMUserName = "DOMAIN\Username"
objAppPool.WAMUserPass = "Password"

objAppPool.SetInfo

 

Starting an Application Pool

This script will allow you to start an application pool. You can also specify Stop() and Recycle()  instead of Start().

option explicit

dim objAppPool

Set objAppPool = GetObject("IIS://localhost/W3SVC/AppPools/DefaultAppPool")
objAppPool.Start()

 

Hopefully these simple scripts will show you how easy Application Pools are to create and enumerate.


VBScript - Modified version of Mk3Site.vbs

This script is a modified version of the IIS 5 Mk3Site.vbs script.

I had a request to do some work and the customer would pay me to re-write the script to support some additional features.

I decided to do the work for free and donate the script to the community. It may have some use for some people.

The new features are:

  • Ability to set the application protection to Low, Medium or High
  • Ability to set the Execute options to None, Scripts or Executables
  • Ability to change the log file period
  • Ability to change the log directory

This script was updated from a previously updated script I wrote back in 2001 and is available from www.iisfaq.com

The new features of that script were:

  • Ability to setup URL redirection while creating the site.

 You can download the script from here.

'------------------------------------------------------------------------------------------------
'
' This is a simple script to create a new virtual web server.
'
' Usage: MakeWebSite      <--RootDirectory|-r ROOT DIRECTORY>
'                         <--Comment|-t SERVER COMMENT>
'                         [--computer|-c COMPUTER1[,COMPUTER2...]]
'                         [--HostName|-h HOST NAME[,HOSTNAME2...]]
'                         [--port|-o PORT NUM]
'                         [--IPAddress|-i IP ADDRESS]
'                         [--SiteNumber|-n SITENUMBER]
'                         [--DontStart]
'                         [--verbose|-v]
'                         [--Write]"
'                         [--Execute { NONE, SCRIPTS, EXECUTABLES } ]"
'                         [--AppProtection { LOW, MEDIUM, HIGH } ]"
'                         [--AppName Name]"
'                         [--LogPeriod { DAILY, WEEKLY, MONTHLY, HOURLY} ]"
'                         [--LogFolder LogFileDirectory]"
'                         [--URL Redirectionpath]
'                         [--URLExact]
'                         [--URLChildOnly]
'                         [--URLPermanent]
'                         [--help|-?]
'
' IP ADDRESS            The IP Address to assign to the new server.  Optional.
' HOST NAME             The host name of the web site for host headers.
'      WARNING: Only use Host Name if DNS is set up find the server.
' PORT NUM              The port to which the server should bind
' ROOT DIRECTORY        Full path to the root directory for the new server.
' SERVER COMMENT        The server comment -- this is the name that appers in the MMC.
' SITENUMBER      The Site Number is the number in the path that the web server
'      will be created at.  i.e. w3svc/3
'
' Example 1: MakeWebSite.vbs -r D:\Roots\Company11 --DontStart -t "My Company Site"
' Example 2: MakeWebSite.vbs -r C:\Inetpub\wwwroot -t Test -o 8080
'
'
' Modified by chris crowe - www.iisfaq.com to support multiple host headers and URL Redirection
'------------------------------------------------------------------------------------------------

' Force explicit declaration of all variables
Option Explicit
'On Error Resume Next
Dim ArgIPAddress, ArgRootDirectory, ArgServerComment, ArgSkeletalDir, ArgHostName, ArgPort
Dim ArgComputers, ArgStart
Dim ArgSiteNumber
Dim oArgs, ArgNum
Dim verbose, FSO
' Chris Crowe - blog.crowe.co.nz
dim ArgLogFolder
dim ArgLogFilePeriod
dim ArgAppFriendlyName
dim ArgAppProtection
dim ArgExecute
dim ArgExecuteScripts
dim ArgExecuteExecutables 
dim ArgWrite
const MD_LOGFILE_PERIOD_MAXSIZE = 0 ' Create new log file after reaching maximum size. 
const MD_LOGFILE_PERIOD_DAILY   = 1 ' Create new log file daily. 
const MD_LOGFILE_PERIOD_WEEKLY  = 2 ' Create new log file weekly. 
const MD_LOGFILE_PERIOD_MONTHLY = 3 ' Create new log file monthly. 
const MD_LOGFILE_PERIOD_HOURLY  = 4 ' Create a new log file hourly. 
' Chris Crowe - iisfaq.com
Dim ArgURL, ArgURLExact, ArgURLChildOnly, ArgURLPermanent
ArgIPAddress = ""
ArgHostName = ""
ArgPort = 80
ArgStart = True
ArgComputers = Array(1)
ArgComputers(0) = "LocalHost"
ArgSiteNumber = 0
verbose = false
' Chris Crowe - blog.crowe.co.nz
ArgLogFolder            = ""
ArgLogFilePeriod        = ""
ArgAppFriendlyName      = ""
ArgAppProtection        = 2
ArgExecute              = ""
ArgWrite                = false
' Chris Crowe - iisfaq.com
ArgURL = ""
ArgURLChildonly = false
ArgURLExact = false
ArgURLPermanent = false
Set oArgs = WScript.Arguments
ArgNum = 0
While ArgNum < oArgs.Count
 Select Case LCase(oArgs(ArgNum))
  Case "--port","-o":
   ArgNum = ArgNum + 1
   ArgPort = oArgs(ArgNum) 
  Case "--ipaddress","-i":
   ArgNum = ArgNum + 1
   ArgIPAddress = oArgs(ArgNum)
  Case "--rootdirectory","-r": 
   ArgNum = ArgNum + 1
   ArgRootDirectory = oArgs(ArgNum)
  Case "--comment","-t":
   ArgNum = ArgNum + 1
   ArgServerComment = oArgs(ArgNum)
  Case "--hostname","-h":
   ArgNum = ArgNum + 1
   ArgHostName = oArgs(ArgNum)
  Case "--computer","-c":
   ArgNum = ArgNum + 1
   ArgComputers = Split(oArgs(ArgNum), ",", -1)
  Case "--sitenumber","-n":
   ArgNum = ArgNum + 1
   ArgSiteNumber = CLng(oArgs(ArgNum))
        ' Chris Crowe - blog.crowe.co.nz
  Case "--logfolder": 
   ArgNum = ArgNum + 1
   ArgLogFolder = oArgs(ArgNum)
  Case "--logperiod": 
   ArgNum = ArgNum + 1
   ArgLogFilePeriod = oArgs(ArgNum)
  Case "--appname": 
   ArgNum = ArgNum + 1
   ArgAppFriendlyName = oArgs(ArgNum)
  Case "--appprotection": 
   ArgNum = ArgNum + 1
   ArgAppProtection= oArgs(ArgNum)
  Case "--execute": 
   ArgNum = ArgNum + 1
   ArgExecute = oArgs(ArgNum)
  Case "--write"
   ArgWrite = true
  
  ' Chris Crowe - iisfaq.com
  Case "--url","-u": 
   ArgNum = ArgNum + 1
   ArgURL = oArgs(ArgNum)
  Case "--urlexact"
   ArgURLEXACT = true
  Case "--urlchildonly"
   ArgURLChildOnly = true
  Case "--urlpermanent"
   ArgURLPERMANENT = true
   
  Case "--dontstart":
   ArgStart = False
  Case "--help","-?":
   Call DisplayUsage
  Case "--verbose", "-v":
   verbose = true
  Case Else:
   WScript.Echo "Unknown argument "& oArgs(ArgNum)
   Call DisplayUsage
 End Select 
 ArgNum = ArgNum + 1
Wend
' Chris Crowe - iisfaq.com
If (ArgRootDirectory = "") Then
 WScript.Echo "Missing Root Directory (Required even with URL redirection path)"
 WScript.Echo ""
 Call DisplayUsage
 WScript.Quit(1)
End If
' Check if the root directory exists
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
  if (FSO.FolderExists(ArgRootDirectory) = False) then
    WScript.echo "The specified root directory does not exist : '" & ArgRootDirectory & "'"
    WScript.Quit(2)
  end if
  
  
  ' Chris Crowe - July 2006
  if (ArgLogFolder > "") then
      if (FSO.FolderExists(ArgLogFolder) = False) then
        WScript.echo "The specified LogFolder directory does not exist : " & ArgLogFolder
        WScript.Quit(2)
      end if
  end if  
  
Set FSO = Nothing

' Chris Crowe - July 2006
if (ArgExecute> "") then
    ArgExecute = ucase(ArgExecute)
    if (ArgExecute = "NONE") then 
        ArgExecuteScripts = false
        ArgExecuteExecutables = false
    elseif (ArgExecute = "SCRIPTS") then 
        ArgExecuteScripts = true
        ArgExecuteExecutables = false
    elseif (ArgExecute = "EXECUTABLES") then 
        ArgExecuteScripts = true
        ArgExecuteExecutables = true
    else
      WScript.echo "The specified Execute value is invalid : " & ArgAppProtection
      WScript.Quit(2)
    end if
end if
if (ArgAppProtection > "") then
    ArgAppProtection = ucase(ArgAppProtection)
    if (ArgAppProtection = "LOW") then ArgAppProtection = 0
    if (ArgAppProtection = "INPROCESS") then ArgAppProtection = 0
    
    if (ArgAppProtection = "HIGH") then ArgAppProtection = 1
    if (ArgAppProtection = "OUTOFPROCESS") then ArgAppProtection = 1
    
    if (ArgAppProtection = "MEDIUM") then ArgAppProtection= 2
    if (ArgAppProtection = "POOLED") then ArgAppProtection = 2
    
    if ((ArgAppProtection = 0) or (ArgAppProtection = 1) or (ArgAppProtection = 2)) then
    else
      WScript.echo "The specified AppProtection value is invalid : " & ArgAppProtection
      WScript.Quit(2)
    end if
end if  
if (ArgLogFilePeriod > "") then
    ArgLogFilePeriod = ucase(ArgLogFilePeriod)
    if (ArgLogFilePeriod = "DAILY") then ArgLogFilePeriod = 1
    if (ArgLogFilePeriod = "WEEKLY") then ArgLogFilePeriod = 2   
    if (ArgLogFilePeriod = "MONTHLY") then ArgLogFilePeriod = 3
    if (ArgLogFilePeriod = "HOURLY") then ArgLogFilePeriod = 4
    
    if ((ArgLogFilePeriod= 0) or (ArgLogFilePeriod= 1) or (ArgLogFilePeriod= 2) or (ArgLogFilePeriod= 3)) then
    else
      WScript.echo "The specified LogFilePeriod is invalid : " & ArgLogFilePeriod
      WScript.Quit(2)
    end if
end if  

If (ArgServerComment = "") Then
 WScript.Echo "Missing Server Comment"
 WScript.Echo ""
 Call DisplayUsage
 WScript.Quit(1)
End If
' end - chris Crowe - iisfaq.com
' chris Crowe - iisfaq.com
Call ASTCreateWebSite(ArgIPAddress, ArgRootDirectory, ArgURL, ArgURLEXACT, ArgURLCHILDONLY, ArgURLPERMANENT, 
ArgServerComment, ArgHostName, ArgPort, ArgComputers, ArgStart) ' chris Crowe - iisfaq.com Sub ASTCreateWebSite(IPAddress, RootDirectory, URL, ArgURLEXACT, ArgURLCHILDONLY, ArgURLPERMANENT,
ServerComment, HostName, PortNum, Computers, Start) Dim w3svc, WebServer, NewWebServer, NewDir, Bindings, BindingString, NewBindings, ComputerIndex
Dim Index, SiteObj, bDone Dim comp, BindingIndex, HostNameINdex, HostNames 'Chris Crowe - www.iisfaq.com Dim URLOPTIONS On Error Resume Next hostNames = Split(HostName,",") For ComputerIndex = 0 To UBound(Computers) comp = Computers(ComputerIndex) If ComputerIndex <> UBound(Computers) Then Trace "Creating web site on " & comp & "." End If ' Grab the web service object Err.Clear Set w3svc = GetObject("IIS://" & comp & "/w3svc") If Err.Number <> 0 Then Display "Unable to open: "&"IIS://" & comp & "/w3svc" End If Trace "Making sure this web server doesn't conflict with another..." For Each WebServer in w3svc If WebServer.Class = "IIsWebServer" Then Bindings = WebServer.ServerBindings For HostNameINdex = 0 To UBound(HostNames) for BindingIndex = 0 to Ubound(Bindings) BindingString = IpAddress & ":" & PortNum & ":" & HostNames(HostNameINdex) If (BindingString = bindings(BindingIndex)) Then Trace "The server bindings you specified are duplicated in another virtual web server." Trace "The Web Server name is [" & WebServer.ServerComment & "], Instance ID [" & WebServer.name & "]" Trace "The Conflicting Bindings are at index [" & bindingIndex & "], [" & bindings(BindingIndex) & "]" WScript.Quit (1) End If next next End If Next Index = 1 bDone = False Trace "Creating new web server..." ' If the user specified a SiteNumber, then use that. Otherwise, ' test successive numbers under w3svc until an unoccupied slot is found If ArgSiteNumber <> 0 Then Set NewWebServer = w3svc.Create("IIsWebServer", ArgSiteNumber) NewWebServer.SetInfo If (Err.Number <> 0) Then WScript.Echo "Couldn't create a web site with the specified number: " & ArgSiteNumber WScript.Quit (1) Else Err.Clear ' Verify that the newly created site can be retrieved Set SiteObj = GetObject("IIS://"&comp&"/w3svc/" & ArgSiteNumber) If (Err.Number = 0) Then bDone = True Trace "Web server created. Path is - "&"IIS://"&comp&"/w3svc/" & ArgSiteNumber Else WScript.Echo "Couldn't create a web site with the specified number: " & ArgSiteNumber WScript.Quit (1) End If End If Else While (Not bDone) Err.Clear Set SiteObj = GetObject("IIS://"&comp&"/w3svc/" & Index) If (Err.Number = 0) Then ' A web server is already defined at this position so increment Index = Index + 1 Else Err.Clear Set NewWebServer = w3svc.Create("IIsWebServer", Index) NewWebServer.SetInfo If (Err.Number <> 0) Then ' If call to Create failed then try the next number Index = Index + 1 Else Err.Clear ' Verify that the newly created site can be retrieved Set SiteObj = GetObject("IIS://"&comp&"/w3svc/" & Index) If (Err.Number = 0) Then bDone = True Trace "Web server created. Path is - "&"IIS://"&comp&"/w3svc/" & Index Else Index = Index + 1 End If End If End If ' sanity check If (Index > 10000) Then Trace "Seem to be unable to create new web server. Server number is "&Index&"." WScript.Quit (1) End If Wend End If on error goto 0 redim NewBindings (ubound(HostNames)) For HostNameINdex = 0 To UBound(HostNames) BindingString = IpAddress & ":" & PortNum & ":" & HostNames(HostNameINdex) Trace "Binding = " & BindingString NewBindings(HostNameINdex) = BindingString next ' Modified by Chris Crowe - July 2006 (Start) if (ArgLogFolder > "") then NewWebServer.LogFileDirectory = ArgLogFolder end if if (ArgLogFilePeriod > "") then NewWebServer.LogFilePeriod = ArgLogFilePeriod end if ' Modified by Chris Crowe - July 2006 (End) NewWebServer.ServerBindings = NewBindings NewWebServer.ServerComment = ServerComment NewWebServer.SetInfo ' Now create the root directory object. Trace "Setting the home directory..." Set NewDir = NewWebServer.Create("IIsWebVirtualDir", "ROOT") NewDir.Path = RootDirectory NewDir.AccessRead = true ' Chris Crowe - July 2006 if (ArgWrite = true) then NewDir.AccessWrite = true end if if (ArgExecute > "") then NewDir.AccessScript = ArgExecuteScripts NewDir.AccessExecute = ArgExecuteExecutables end if ' Modified by Chris crowe - January 2002 if (URL <> "") then trace "Redirection to a URL: " & URL URLOPTIONS= "" if (ArgURLEXACT = true) then URLOPTIONS = ", EXACT_DESTINATION" end if if (ArgURLCHILDONLY = true) then if (URLOPTIONS > "") then URLOPTIONS = URLOPTIONS & ", CHILD_ONLY" else URLOPTIONS = ", CHILD_ONLY" end if end if if (ArgURLPERMANENT = true) then if (URLOPTIONS > "") then URLOPTIONS = URLOPTIONS & ", PERMANENT" else URLOPTIONS = ", PERMANENT" end if end if trace "Redirection Flags : " & URLOPTIONS newDir.httpredirect= URL & URLOPTIONS end if ' Modified by Chris crowe - January 2002 Err.Clear NewDir.SetInfo ' Chris Crowe - July 2006 NewDir.AppCreate2 (ArgAppProtection) if (ArgAppFriendlyName > "") then NewDir.AppFriendlyName = ArgAppFriendlyName NewDir.SetInfo end if If (Err.Number = 0) Then Trace "Home directory set." Else Display "Error setting home directory." End If Trace "Web site created!" If Start = True Then Trace "Attempting to start new web server..." Err.Clear Set NewWebServer = GetObject("IIS://" & comp & "/w3svc/" & Index) NewWebServer.Start If Err.Number <> 0 Then Display "Error starting web server!" Err.Clear Else Trace "Web server started succesfully!" End If End If Next End Sub ' Display the usage message Sub DisplayUsage WScript.Echo "Usage: MakeWebSite <--RootDirectory|-r ROOT DIRECTORY>" WScript.Echo " <--Comment|-t SERVER COMMENT>" WScript.Echo " [--computer|-c COMPUTER1[,COMPUTER2...]]" WScript.Echo " [--port|-o PORT NUM]" WScript.Echo " [--IPAddress|-i IP ADDRESS]" WScript.Echo " [--HostName|-h HOST NAME[,HOSTNAME2...]]" WScript.Echo " [--SiteNumber|-n SITENUMBER]" WScript.Echo " [--AppProtection Level { LOW, MEDIUM, HIGH } ]" WScript.Echo " [--AppName Name]" WScript.Echo " [--Write]" WScript.Echo " [--Execute { NONE, SCRIPTS, EXECUTABLES } ]" WScript.Echo " [--LogPeriod LogFilePeriod { DAILY, WEEKLY, MONTHLY, HOURLY}]" WScript.Echo " [--LogFolder LogFileDirectory]" WScript.Echo " [--URL RedirectionPath]" WScript.Echo " [--URLExact]" WScript.Echo " [--URLChildOnly]" WScript.Echo " [--URLPermanent]" WScript.Echo " [--DontStart]" WScript.Echo " [--verbose|-v]" WScript.Echo " [--help|-?]" WScript.Echo "" WScript.Echo "WARNING: Only use Host Name if DNS is set up find the server." WScript.Echo "" WScript.Echo "Example 1: MakeWebSite.vbs -r D:\Roots\Company11 --DontStart -t ""My Company Site""" WScript.Echo "Example 2: MakeWebSite.vbs -r D:\Roots\Company11 -h ""www.iisfaq.com,www.iis.com"" --DontStart
-t "
"My Company Site""" WScript.Echo "Example 3: MakeWebSite.vbs -r D:\Roots\Company11 -i 192.168.0.1 -t ""My Company Site""
--URL http://www.iisfaq.com --URLExact --URLPermanent"
WScript.Echo "Example 4: MakeWebSite.vbs -r D:\Roots\Company11 --DontStart -t ""My Company Site""
--LogPeriod MONTHLY --LogFolder c:\Root\Company1"
WScript.Echo "Example 5: MakeWebSite.vbs -r D:\Roots\Company11 --DontStart -t ""My Company Site""
--AppName XYZ --LogFolder c:\Root\Company1" WScript.Echo "" WScript.Echo "Note: URLRedirection requires a HTTP:// prefix and a root directory also!" WScript.Echo " Write enables write access to the directory" WScript.Echo "" WScript.Quit (1) End Sub Sub Display(Msg) WScript.Echo Now & ". Error Code: " & Hex(Err) & " - " & err.Description & " - " & Msg End Sub Sub Trace(Msg) if verbose = true then WScript.Echo Now & " : " & Msg end if End Sub

Some examples of scripting of IIS using ADSI, WMI from VB and C# including the new Microsoft.Web.Administration namespace

Below are some simple examples of how to talk to IIS via ADSI, WMI and the new IIS 7 only .NET Managed Provider.

The IIS ADSI Provider

The IIS ADSI provider exposes COM Automation objects that you can use within command-line scripts, ASP pages, or custom applications to change IIS configuration values stored in the IIS metabase. IIS ADSI objects can be accessed and manipulated by any language that supports automation, such as Microsoft® Visual Basic® Scripting Edition (VBScript), Microsoft JScript®, Perl, Microsoft Active Server Pages (ASP), Visual Basic, Java, or Microsoft C++.

The IIS WMI Provider

Windows Management Instrumentation (WMI) is a technology that allows administrators to programmatically manage and configure the Windows operating system and Windows applications. Beginning with IIS 6.0, IIS includes a WMI provider that exposes programming interfaces that can be used to query and configure the IIS metabase.

The Microsoft.Web.Administration namespace in IIS 7

 This is a new .NET managed namespace that will allow you to talk to IIS 7 and configure all aspects of the server. This API is designed to be simple to code against in an “intellisense-driven” sort of way. At the root level a class called ServerManager exposes all the functionality you will need. At this time it appears that this will not be able to be used from Windows XP but by the time Vista & Windows Server are released this may have been ported to run on a Windows XP client.
 

For more details on these technologies see the following resources:


C# -Using System.DirectoryServices and ADSI

using System;
using System.Collections.Generic;
using System.Text;
// Must be specified and a reference added to System.DirectoryServices
using System.DirectoryServices;

namespace Console_EnumSites_ADSI_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/W3SVC");
            foreach (DirectoryEntry site in entry.Children)
            {
                if (site.SchemaClassName == "IIsWebServer")
                {
                    string ServerComment = site.Properties["ServerComment"].Value.ToString();
                    Console.WriteLine(ServerComment + " (" + site.Name + ")");
                }
            }
        }
    }
}

VB -Using ADSI

on error resume next

dim websrv, site
dim webinfo

set websrv = getobject("IIS://Localhost/W3SVC")
if (err <> 0) then
else
    err.Clear
    for each site in websrv
        if (site.classname = "IIsWebServer") then
            WScript.echo Site.ServerComment & " (" & Site.Name & ")"
        end if
    next
end if

C# -Using System.Managment and WMI

using System;
using System.Collections.Generic;
using System.Text;
using System.Management;

namespace Console_EnumSites_WMI_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementScope oms = new ManagementScope(@"\\.\root\MicrosoftIISv2");
            oms.Connect();

            ObjectQuery oQuery = new ObjectQuery("select * from IISWebServerSetting");
            ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oms, oQuery);
            foreach (ManagementObject oreturn in oSearcher.Get())
            {
                Console.WriteLine(oreturn["ServerComment"]+" ("+oreturn["Name"]+")");
            }
            Console.Read();
        }
    }
}

C# -Using Microsoft.Web.Administration ( II7 Only )

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;

namespace Console_EnumSites
{
    class Program
    {
        static void Main(string[] args)
        {
            ServerManager iisManager = new ServerManager();

            Console.WriteLine("Display IIS Sites in IIS 7");
            Console.WriteLine("".PadLeft(40,'-'));
            foreach(Site site in iisManager.Sites)
            {
                Console.WriteLine("{0} {1}", site.Id.ToString().PadRight(12), site.Name);                
            }
            Console.Read();
        }
    }
}

IIS Metabase Explorer
The IIS Metabase Explorer provides a graphical user interface for viewing and editing IIS metabase stores. You can use Metabase Explorer to export and import keys and subkeys, copy keys and subkeys, edit security settings for keys, and compare records within the metabase.

This tool can be used to perform a wide variety of tasks to help you manage the IIS Metabase. For example, you can use it to back up or restore parts of the metabase. You can also use it to reset the default IIS Web site, or allow a non-administrator account to change the metabase by adding a restricted write access control list (ACL) to specific metabase nodes.

Metabase Explorer can be used to edit the metabase for IIS versions 4.0, 5.0, and 6.0, and lets you connect to both local and remote metabases.

To use Metabase Explorer, you’ll need to install the IIS 6.0 Resource Kit Tools (see Knowledge Base article 840671 The IIS 6.0 Resource Kit Tools for download details).

MetabaseExplorer is compatible with the Microsoft® Windows® 2000, Windows XP Professional, and Windows Server 2003 operating systems. It also requires Microsoft® .NET Framework version 1.1


Christchurch .NET Users Group Meeting - June 21st, 2006

I had the pleasure to present to the Christchurch .NET Users Group ( http://www.dot.net.nz ) last evening. It was a very cold night with hail, sleet, rain and we had around 25 people attend.

I spoke about three topics in my presentation:

IIS Scripting

In the talk on IIS Scripting I discussed the different providers that were available to manage IIS from a command line script or application. These include ADSI and WMI, Admin Base Objects and the new IIS 7 Managed Provider.

References:

IIS Diagnostic Tools

In the discussion about IIS diagnostic tools I presented details on the following tools from the Debug Diagnostic Toolkit for IIS.

Authentication and Access Control Diagnostics

Authentication and Access Control Diagnostics (Authdiag) Version 1.0 allows you to review, test, and correct problems with Internet Information Services (IIS) authentication and authorization. You can use Authdiag to check settings on Web sites, FTP sites, virtual directories, Web directories, and files. Authdiag can help you troubleshoot the following types of issues:

SSL Diagnostics

It provides a centralized location to display all relevant SSL configuration information. Most of this information is stored in the metabase, which is the main IIS configuration file. Information related to certificates is also stored in the Windows registry.

SSL Diagnostics checks for the correct configuration of SSL objects and settings. These include client and server certificates, ports, private keys, and Web site states.

Administrators can test whether their current server certificate is working properly by temporarily replacing the current certificate with a self-signed certificate. Administrators are able to test their certificates with a single click of the mouse.

Administrators can use SSL Diagnostics to quickly simulate the connection, or handshake, between the server and browser, and review the response from the server. This is very helpful for determining where in the SSL handshake process the connection is breaking down.

Debug Diagnostics

Debug Diagnostics (DebugDiag) 1.0 is a comprehensive tool designed to help IIS administrators or developers determine why a IIS worker process is crashing, hanging, or memory leak. It offers a simple User Interface to build rules for capturing these common problems with web applications and also offers a built-in analysis system

References:

IIS7

In the IIS 7 section of the presentation I discussed some of the benefits of the new server and its new modular architecture, new UI, new extensibility, and diagnostics functionality.

I showed a number of demos of IIS 7 including a custom Basic Authentication module, a custom Directory Browsing Module, Tracing Features, Debugging a crashing application pool with Debug Diag and some features of the new User Interface.

References


My presentation was made on the Beta 2 build of Vista Ultimate and most of the tools worked fine on Vista and IIS 7 even though they are not designed to. As far as I know no body left early - a good sign.... IIS can be a dry topic to developers but I hope they learned something useful about the new product and of course scripting and diagnostics that they may not have known previously.


IIS Insider - June 2006 - Written by me....

I have had my first set of questions & answers on the Microsoft FTP Server published in June IIS Insider section on www.microsoft.com

IIS Insider is a monthly column designed to answer your questions on how to troubleshoot and make the most of Microsoft Internet Information Services (IIS).

IIS Insider

The questions I presented are:

  • Adding Virtual Directories to an FTP Server
  • Administering Physical Directories on an FTP Site
  • User Isolation Mode options

The article is up for the month of June (it only went up today June 22) at http://www.microsoft.com/technet/community/columns/insider/default.mspx

After June you can see the details on the IIS Insider column archives


Ripcord software has released IISxpress for IIS 5, 5.1 and 6.0 ( that is 2k, XP, and 2k3)

IISxpress is a compression engine for IIS 5.0/5.1/6.0. Based on the ZLIB compression library IISxpress is a high performance, stable, scalable compression extension to IIS. Version 2.0 introduces native 64bit support, new configuration wizards, significant performance improvements (over 100% in some cases) and a new Community Edition which is free for non-commercial, non-governmental use.

IISxpress uses an opt-out rule model to simplify configuration - all content is compressed unless configured otherwise. IISxpress is pre-configured with a suitable set of default rules when first installed, you are free to add and remove rules as you see fit. IISxpress supports rules based on the extension of the file requested, the MIME (content type) type of the response, the path of the request (URI) or the source IP address of the client.

IISxpress allows you to track compression effectiveness at the server level right down to each individual request allowing you to fine tune your server's performance for real world loading.

Key features

  • User friendly interface
  • Highly configurable
  • Real time compression performance monitoring
  • NEW in 2.0: Helpful context sensitive wizards
  • NEW in 2.0: 64bit and multi-core support
  • NEW in 2.0: Community Edition version – free for non-commercial, non-governmental use.
  • Scalable – CPU and memory load sensitive
  • Supports ASP, ASP.NET, etc.

 

Benefits

  • Faster content delivery
  • Improved site responsiveness
  • Less server bandwidth usage
  • 100% client browser and search bot compatibility

 

Audience

  • Internet Web Site Administrators
  • Intranet Web Site Administrators
  • Web Site Developers

 

Supported Platforms

  • Windows 2003: All server versions, 32 and 64 bit
  • Windows 2000: Professional and all sever versions
  • Windows XP Professional: 32 and 64 bit

See http://www.ripcordsoftware.com/IISxpress/default.aspx for more details


Webcast: Exploring the Future of Web Development and Management with Internet Information Services (IIS) 7.0
Bill Staples, Product Unit Manager on the IIS team, will be hosting an upcoming TechNet Webcast titled Exploring the Future of Web Development and Management with Internet Information Services (IIS) 7.0.  Join the WebCast and see cool IIS 7.0 demos for many of the new features.

Date/Time: 6/20/2006 1:00 PM Pacific
Duration: 90 minutes
Attendee Registration URL: http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032299053&Culture=en-US

C# - How to display MimeMap entries to the console from an instance of IIS

 The following c# application will return all of the MimeMaps defined in an IIS instance. The MimeMaps hold the mime types that IIS uses to return the ContentType header.

An example of such a header is application/octetstream

This example requires a reference to the Active DS IIS Namespace Provider in Visual Studio .NET. This reference enables you to use the IISOle namespace to access the IISMimeType class.

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;
using System.DirectoryServices;
using System.Collections;
namespace IISMIMEType
{
    class Program
    {
        static void Main(string[] args)
        {
            // Maintain a sorted list to contain the MIME Types
            SortedList sl = new SortedList();
            Console.WriteLine("IIS Mime Map - c#");
            Console.WriteLine();
            // Serve to connect to...
            string ServerName = "LocalHost";
            // Define the path to the metabase
            string MetabasePath = "IIS://" + ServerName + "/MimeMap";
            // Note: This could also be something like
            // string MetabasePath = "IIS://" + ServerName + "/w3svc/1/root";
            try
            {
                // Talk to the IIS Metabase to read the MimeMap Metabase key
                DirectoryEntry MimeMap = new DirectoryEntry(MetabasePath);
                // Get the Mime Types as a collection
                PropertyValueCollection pvc = MimeMap.Properties["MimeMap"];
                // Add each Mime Type so we can display it sorted later
                foreach (object Value in pvc)
                {
                    // Convert to an IISOle.MimeMap - Requires a connection to IISOle
                    // IISOle can be added to the references section in VS.NET by selecting
                    // Add Reference, selecting the COM Tab, and then finding the 
                    // Active DS Namespace provider
                    IISOle.MimeMap mimetypeObj = (IISOle.MimeMap)Value;
                    // Add the mime extension and type to our sorted list.
                    sl.Add(mimetypeObj.Extension, mimetypeObj.MimeType);
                }
                // Render the sorted MIME entries
                if (sl.Count == 0)
                    Console.WriteLine("No MimeMap entries are defined at {0}!", MetabasePath);
                else
                    foreach (string Key in sl.Keys)
                        Console.WriteLine("{0} : {1}", Key.PadRight(20), sl[Key]);
            }
            catch (Exception ex)
            {
                if ("HRESULT 0x80005006" == ex.Message)
                    Console.WriteLine(" Property MimeMap does not exist at {0}", MetabasePath);
                else
                    Console.WriteLine("An exception has occurred: \n{0}", ex.Message);
            }
        }
    }
}
    


Example Output

.*  application/octet-stream
.323  text/h323
.acx  application/internet-property-stream
.ai  application/postscript
.aif  audio/x-aiff
.aifc  audio/aiff
.aiff  audio/aiff
.application  application/x-ms-application
.asf  video/x-ms-asf
.asr  video/x-ms-asf
.asx  video/x-ms-asf
.au  audio/basic
.avi  video/x-msvideo
.axs  application/olescript
.bas  text/plain
.bcpio  application/x-bcpio
.bin  application/octet-stream
.bmp  image/bmp
.c  text/plain
.cat  application/vndms-pkiseccat
.cdf  application/x-cdf
.cer  application/x-x509-ca-cert
.clp  application/x-msclip
.cmx  image/x-cmx
.cod  image/cis-cod
.cpio  application/x-cpio
.crd  application/x-mscardfile
.crl  application/pkix-crl
.crt  application/x-x509-ca-cert
.csh  application/x-csh
.css  text/css
.dcr  application/x-director
.deploy  application/octet-stream
.der  application/x-x509-ca-cert
.dib  image/bmp
.dir  application/x-director
.disco  text/xml
.dll  application/x-msdownload
.doc  application/msword
.dot  application/msword
.dvi  application/x-dvi
.dxr  application/x-director
.eml  message/rfc822
.eps  application/postscript
.etx  text/x-setext
.evy  application/envoy
.exe  application/octet-stream
.fif  application/fractals
.flr  x-world/x-vrml
.gif  image/gif
.gtar  application/x-gtar
.gz  application/x-gzip
.h  text/plain
.hdf  application/x-hdf
.hlp  application/winhlp
.hqx  application/mac-binhex40
.hta  application/hta
.htc  text/x-component
.htm  text/html
.html  text/html
.htt  text/webviewhtml
.ico  image/x-icon
.ief  image/ief
.iii  application/x-iphone
.ins  application/x-internet-signup
.isp  application/x-internet-signup
.IVF  video/x-ivf
.jfif  image/pjpeg
.jpe  image/jpeg
.jpeg  image/jpeg
.jpg  image/jpeg
.js  application/x-javascript
.latex  application/x-latex
.lsf  video/x-la-asf
.lsx  video/x-la-asf
.m13  application/x-msmediaview
.m14  application/x-msmediaview
.m1v  video/mpeg
.m3u  audio/x-mpegurl
.man  application/x-troff-man
.manifest  application/x-ms-manifest
.mdb  application/x-msaccess
.me  application/x-troff-me
.mht  message/rfc822
.mhtml  message/rfc822
.mid  audio/mid
.mmf  application/x-smaf
.mny  application/x-msmoney
.mov  video/quicktime
.movie  video/x-sgi-movie
.mp2  video/mpeg
.mp3  audio/mpeg
.mpa  video/mpeg
.mpe  video/mpeg
.mpeg  video/mpeg
.mpg  video/mpeg
.mpp  application/vnd.ms-project
.mpv2  video/mpeg
.ms  application/x-troff-ms
.mvb  application/x-msmediaview
.nc  application/x-netcdf
.nws  message/rfc822
.oda  application/oda
.ods  application/oleobject
.p10  application/pkcs10
.p12  application/x-pkcs12
.p7b  application/x-pkcs7-certificates
.p7c  application/pkcs7-mime
.p7m  application/pkcs7-mime
.p7r  application/x-pkcs7-certreqresp
.p7s  application/pkcs7-signature
.pbm  image/x-portable-bitmap
.pdf  application/pdf
.pfx  application/x-pkcs12
.pgm  image/x-portable-graymap
.pko  application/vndms-pkipko
.pma  application/x-perfmon
.pmc  application/x-perfmon
.pml  application/x-perfmon
.pmr  application/x-perfmon
.pmw  application/x-perfmon
.png  image/png
.pnm  image/x-portable-anymap
.pnz  image/png
.pot  application/vnd.ms-powerpoint
.ppm  image/x-portable-pixmap
.pps  application/vnd.ms-powerpoint
.ppt  application/vnd.ms-powerpoint
.prf  application/pics-rules
.ps  application/postscript
.pub  application/x-mspublisher
.qt  video/quicktime
.ra  audio/x-pn-realaudio
.ram  audio/x-pn-realaudio
.ras  image/x-cmu-raster
.rgb  image/x-rgb
.rmi  audio/mid
.roff  application/x-troff
.rtf  application/rtf
.rtx  text/richtext
.scd  application/x-msschedule
.sct  text/scriptlet
.setpay  application/set-payment-initiation
.setreg  application/set-registration-initiation
.sh  application/x-sh
.shar  application/x-shar
.sit  application/x-stuffit
.smd  audio/x-smd
.smx  audio/x-smd
.smz  audio/x-smd
.snd  audio/basic
.spc  application/x-pkcs7-certificates
.spl  application/futuresplash
.src  application/x-wais-source
.sst  application/vndms-pkicertstore
.stl  application/vndms-pkistl
.stm  text/html
.sv4cpio  application/x-sv4cpio
.sv4crc  application/x-sv4crc
.t  application/x-troff
.tar  application/x-tar
.tcl  application/x-tcl
.tex  application/x-tex
.texi  application/x-texinfo
.texinfo  application/x-texinfo
.tgz  application/x-compressed
.tif  image/tiff
.tiff  image/tiff
.tr  application/x-troff
.trm  application/x-msterminal
.tsv  text/tab-separated-values
.txt  text/plain
.uls  text/iuls
.ustar  application/x-ustar
.vcf  text/x-vcard
.wav  audio/wav
.wbmp  image/vnd.wap.wbmp
.wcm  application/vnd.ms-works
.wdb  application/vnd.ms-works
.wks  application/vnd.ms-works
.wmf  application/x-msmetafile
.wps  application/vnd.ms-works
.wri  application/x-mswrite
.wrl  x-world/x-vrml
.wrz  x-world/x-vrml
.wsdl  text/xml
.xaf  x-world/x-vrml
.xbm  image/x-xbitmap
.xla  application/vnd.ms-excel
.xlc  application/vnd.ms-excel
.xlm  application/vnd.ms-excel
.xls  application/vnd.ms-excel
.xlt  application/vnd.ms-excel
.xlw  application/vnd.ms-excel
.xml  text/xml
.xof  x-world/x-vrml
.xpm  image/x-xpixmap
.xsd  text/xml
.xsl  text/xml
.xwd  image/x-xwindowdump
.z  application/x-compress
.zip  application/x-zip-compressed
 

For more details on MimeMaps see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/b9b7a30c-5d24-4310-bb70-398c3129f6b3.asp

For more details on using System.DirectoryServices to configure IIS see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/d39fae66-abe7-4902-a3fc-f36151561f01.asp?frame=true


Windows XP IIS Manager v1.7 aka Easy IIS

Windows XP IIS Manager v1.7 aka EasyIIS

I keep forgetting to blog about this tool which is up on www.codeproject.com - this tool includes source in C++ and the binary files as well.

Why do you want it?

Well basically IIS on Windows 2000 Professional or Windows XP Professional will only allow you to create one web site. This can be a problem when developing code for multiple web sites (not such an issue with ASP.NET v2 with the build in Development Web Server but still an issue).

So IIS will only allow the Default Web Site via the UI, but you have always been able to create new web sites using ADSI or WMI so why do you need it?

Simple - it makes life easy...

Limitations

Like most of the limitation in IIS on Windows XP you can't get get around them. Althgouh you can create multuple sites you can only have one of them active at a time. This means that you can still only really work on the one project at once.

Also there may be issues with the creation of Application Root's based on some of the comments but in general a very useful tool.

You can download this tool and its source code from http://www.codeproject.com/w2k/EasyIIS.asp


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
http://blogs.officezealot.com/charles/archive/2004/10/26/3191.aspx

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.


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 http://blog.crowe.co.nz/archive/2005/12/08/346.aspx 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

 


Simple VB Script to show the authentication methods enabled for directories in a web site.

The following script will allow you to process all physcial and virtual directories for a particular web site and show what authentication methods are enabled.

Each directory will have one or more of the following to determine the authentication methods enabled.

  • A = Anonymous
  • B = Basic
  • D = Digest
  • N = NTLM
  • S = SSL
  • S128 = SSL 128 Bit

You must specify the web site instance id when calling the script. In the case of Windows XP Pro there is (by default) only one web site which has an instance ID of 1. If you are running multiple web sites on a Server OS or you have created multiple web sites on XP pro then you can find the web site instance ID by the following method.

  • Right click the web site, select properties, on the web site tab under logging click the Properties button, part of the log file name will contain the web site #

    example log filename: W3SVC1\exyymmdd.log  - the web site is 1
                                     W3SVC45\exyymmdd.log - the web site is 45

Calling Usage:   cscript EnumAuthenticationMethods.vbs  InstanceID

Example Output

You can download the source for this script here (just rename to .VBS from the .TXT file that it is now)

function EnumVirtualDirectories(LevelMachineNameObjectPathDirStyle)
  Dim ChildObjectIISObkect

  on error resume next
  Err.Clear

  IIsObjectPath = "IIS://" & MachineName
  If (ObjectPath = ""Then
    exit function
  else
    IIsObjectPath = IIsObjectPath & "/" & ObjectPath
  End If

  'WScript.Echo "Checking : " & IISObjectPath

  Set IIsObject = GetObject(IIsObjectPath)

  If (Err.Number <> 0Then
    if (Level = 1then
      WScript.Echo "Error: " & Err.Description & " (" & Err.Number & ")"
    end if
    exit function
  End If

  Err.Clear

  For Each ChildObject In IIsObject
    If (Err.Number <> 0Then
      '    WScript.Echo "Error = " & Err.Description
      '      Exit For
    end if

    if (ChildObject.Class = DirStylethen
      ChildObjectName = Right(ChildObject.AdsPathLen(ChildObject.AdsPath- 6)
      ChildObjectName = Right(ChildObjectNameLen(ChildObjectName- InStr(ChildObjectName"/") )

      if (len(ChildObjectName< 60then
        ChildObjectName = ChildObjectName & space(60-len(childObjectName))
      end if

      Annonymous  = " "
      Basic    = " "
      Digest    = " "
      NTLM    = " "
      SSL      = " "
      SSL128    = " "

      if (ChildObject.AuthAnonymousthen Annonymous = "A"
      if (ChildObject.AuthBasicthen Basic = "B"
      if (ChildObject.AuthDigestthen Digest = "D"
      if (ChildObject.AuthNTLMthen NTLM = "N"

      if (ChildObject.AccessSSLthen SSL = "S"
      if (ChildObject.AccessSSL128then SSL128 = "128"

      WScript.Echo ChildObjectName & " " & Annonymous & " " & Basic & " " & Digest & " " & _
          NTLM & " " & SSL & SSL128

      EnumVirtualDirectories Level+1MachineName,  ChildObjectNameDirStyle
    end if
  next

End Function

Sub DisplayHelpMessage()
  WScript.Echo
  WScript.Echo "Usage:"
  WScript.Echo "      EnumAuthenticationMethods.VBS WebSiteNumber"
  WScript.Echo
  WScript.Echo "WebSiteNumber is the number of the web site, you have two methods to determine this:"
  WScript.Echo
  WScript.Echo "#1 = Run FINDWEB.VBS"
  WScript.Echo "#2 = Right click the web site, select properties, on the web site tab"
  WScript.Echo "     under logging click the Properties button, part of the log file"
  WScript.Echo "     name will contain the web site #"
  WScript.Echo
  WScript.Echo "     example log filename: W3SVC1\exyymmdd.log  - the web site is 1"
  WScript.Echo "                           W3SVC45\exyymmdd.log - the web site is 45"
end sub

Const GENERAL_FAILURE = 2

' Get the Arguments object
Set ArgObj = WScript.Arguments

' Test to make sure there is at least one command line arg - the command
If ArgObj.Count < 1 Then
  DisplayHelpMessage
  WScript.Quit (GENERAL_FAILURE)
End If

Servername = "LocalHost"
WebSiteID    = ArgObj(0)
WebSite        = "W3SVC/" & WebSiteID & "/Root"
Level             = 1

WScript.Echo "Authentication Methods:"
WScript.Echo "    A=Anonymous, B=Basic, D=Digest, N=NTLM, S=SSL, S128=SSL 128bit"
WScript.Echo ""
WScript.Echo "Virtual Directories for " & WebSite
EnumVirtualDirectories LevelServerNameWebSite"IIsWebVirtualDir"

WScript.Echo ""
WScript.Echo "Physical Directories for " & WebSite
EnumVirtualDirectories LevelServerNameWebSite"IIsWebDirectory"


Simple VB Script to show what directories allow anonymous access or not for a web site.

I saw a request on the Microsoft.Public.InetServer.IIS newsgroup today and so I modified a prevously written script I wrote on www.iisfaq.com to do the task.

Question

  • I'm running an IIS 5.1 web server at home (Windows XP Pro), and what I was hoping to do is list all of the directories for a web site which have anonymous access disabled

Answer

The following script will allow you to process all physcial and virtual directories for a particular web site and show if they allow anonymous access or not.

You must specify the web site instance id.

In the case of Windows XP Pro there is (by default) only one web site which has an instance ID of 1.

If you are running multiple web sites on a Server OS or you have created multiple web sites on XP pro then you can find the web site instance ID by the following method.

  • Right click the web site, select properties, on the web site tab under logging click the Properties button, part of the log file name will contain the web site #

    example log filename: W3SVC1\exyymmdd.log  - the web site is 1
                                     W3SVC45\exyymmdd.log - the web site is 45

Calling Usage:   cscript EnumAnonymousAccessDiabled.vbs  InstanceID

Example Output

You can download the source for this script here (just rename to .VBS from the .TXT file that it is now)

function EnumVirtualDirectories(LevelMachineNameObjectPathDirStyle)
  Dim ChildObjectIISObkect

  on error resume next
  Err.Clear

  IIsObjectPath = "IIS://" & MachineName
  If (ObjectPath = ""Then
    exit function
  else
    IIsObjectPath = IIsObjectPath & "/" & ObjectPath
  End If

  'WScript.Echo "Checking : " & IISObjectPath

  Set IIsObject = GetObject(IIsObjectPath)

  If (Err.Number <> 0Then
    if (Level = 1then
      WScript.Echo "Error: " & Err.Description & " (" & Err.Number & ")"
    end if
    exit function
  End If

  Err.Clear

  For Each ChildObject In IIsObject
    If (Err.Number <> 0Then
      '    WScript.Echo "Error = " & Err.Description
      '      Exit For
    end if

    if (ChildObject.Class = DirStylethen
      ChildObjectName = Right(ChildObject.AdsPathLen(ChildObject.AdsPath- 6)
      ChildObjectName = Right(ChildObjectNameLen(ChildObjectName- InStr(ChildObjectName"/") )

      if (len(ChildObjectName< 60then
        ChildObjectName = ChildObjectName & space(60-len(childObjectName))
      end if
      WScript.Echo ChildObjectName & " - " & ChildObject.AuthAnonymous

      EnumVirtualDirectories Level+1MachineName,  ChildObjectNameDirStyle
    end if
  next

End Function

Sub DisplayHelpMessage()
  WScript.Echo
  WScript.Echo "Usage:"
  WScript.Echo "      EnumAnonymousAccessDisabled.VBS WebSiteNumber"
  WScript.Echo
  WScript.Echo "WebSiteNumber is the number of the web site, you have two methods to determine this:"
  WScript.Echo
  WScript.Echo "#1 = Run FINDWEB.VBS"
  WScript.Echo "#2 = Right click the web site, select properties, on the web site tab"
  WScript.Echo "     under logging click the Properties button, part of the log file"
  WScript.Echo "     name will contain the web site #"
  WScript.Echo
  WScript.Echo "     example log filename: W3SVC1\exyymmdd.log  - the web site is 1"
  WScript.Echo "                           W3SVC45\exyymmdd.log - the web site is 45"
end sub

Const GENERAL_FAILURE = 2

' Get the Arguments object
Set ArgObj = WScript.Arguments

' Test to make sure there is at least one command line arg - the command
If ArgObj.Count < 1 Then
  DisplayHelpMessage
  WScript.Quit (GENERAL_FAILURE)
End If

Servername = "LocalHost"
WebSiteID    = ArgObj(0)
WebSite        = "W3SVC/" & WebSiteID & "/Root"
Level             = 1

WScript.Echo "Allow Anonymous Access"
WScript.Echo ""
WScript.Echo "Virtual Directories for " & WebSite
EnumVirtualDirectories LevelServerNameWebSite"IIsWebVirtualDir"

WScript.Echo ""
WScript.Echo "Physical Directories for " & WebSite
EnumVirtualDirectories LevelServerNameWebSite"IIsWebDirectory"

IIS Directory Browsing

IIS supports a directory browsing mode where you can view a list of files and directories instead of viewing an HTML page.

This is very useful for example when you have a lot of files and folders such as an MP3 collection.

To enable this mode you select either a Physical or Virtual directory in the Internet Information Services application and select properties and then select the Directory Browsing check box as shown below.

Once you enable this option when you browse to the directory or any child directories they will be shown using the built in directory browsing module.

In the above view there is a single file and a single directory displayed, and they map to the following physical directory which is the home directory for the web site; in this case c:\inetpub\websites\directorybrowsing

Hiding Files

If you have some files in your directory that you do not want the user to see you must mark them as Hidden using the Windows Explorer file properties dialog.

Note: If you mark the file as hidden even if you know the name of the file you can not download the file (an HTTP 404 error will be produced)

Why do my Virtual Directories not show up in the browse list?

In the example above we have a virtual directory called Music which is pointing to e:\music (directory browsing has been enabled for the Web Site Root and also for the Music Virtual directory)

When you browse the web site you do not see the Music Virtual directory.

This is a special case where IIS does not show the virtual directory but if you knew the name of the virtual directory and manually entered it into the address bar you would see the files as shown below.

The way to make sure your users can see the virtual directory while they are browsing the root is to create a physical directory with the same name in the physical folder of the parent directory.

So in our case our parent directory points to c:\inetpub\websites\directorybrowsing so we must create a folder called Music in the c:\inetpub\websites\DirectoryBrowsing folder.

Nothing has to exist in this new empty Music directory and as soon as you create the folder and refresh the listing you will see the directory shown in the web browser and you have the ability to navigate into it as we would any other directory.

Applying your own style to the directory listing

You can't.....


IIS Applications - don't remove it from the Root of your web site....

IIS Applications

An IIS application is any file that is executed within a defined set of directories in your Web site. When you create an application, you use the Internet Information Services snap-in to designate the application's starting-point directory (also called an application root) in your Web site. Every file and directory under the starting-point directory in your Web site is considered part of the application until another starting-point directory is found. You thus use directory boundaries to define the scope of an application.

If you remove the IIS Application from the web site properties dialog you will find that you can not connect to your web site at all and you will not get any errors and trying to identify the problem could be quite difficult.

Using a packet sniffer I received the following information when I made a request to my web site:

 

If you open IE 6 and enter the URL the following will be displayed.

 

If you then click refresh IE just sits there in an endless loop....

Errors

  • Nothing is logged in the Web Site Log file
  • Nothing is logged in the Event Log
  • Nothing is logged in the HTTPERR log file

Obviously the fix is to recreate the IIS Application by simply clicking on the Create button on the Home Directory tab. 

As soon as you do this your web site will work again, but this could be something that could catch someone out.

An interesting side affect of this is if you then create a virtual directory (make sure the IIS Application is created for the Virtual Directory, but not the root) you can access the virtual directory but not the root of the site. Is this security by obsecurity?


FTP User Editor for Active Directory (Updated)

The FTP User Editor for Microsoft Active Directory has been updated a fix a couple of problems.

Bugs

  • There was a limit of 1000 objects being returned from the Active Directory - increased to 32768. 

You can download and install from:

For more details on the FTP User Editor please see the original post at http://blog.crowe.co.nz/archive/2006/02/15/556.aspx


Internet Information Services (IIS) 6.0 Manager for Windows XP (not saving added servers)

Overview

With IIS 6.0 Manager for Windows XP, administrators can remotely manage an IIS 6.0 server from a Windows XP Professional workstation. This tool only installs a snap-in for Microsoft Management Console and its associated DLLs and documentation; it does not install the complete IIS 6.0 server on your local computer.
 
  • This tool is available only in English. When installed on non-English editions of Windows XP, IIS 6.0 Manager, documentation, folders, and shortcuts appear as English-only.
     
  • After installation, IIS 6.0 Manager and IIS 5.1 Manager coexist in separate directories on the same computer.

     
  • Start the IIS 6.0 Manager after installation from the administrative tools folder in the Control Panel, not from the Computer Management console. If the IIS 5.1 Manager is also installed, it will appear in the Computer Management console, not the IIS 6.0 Manager.

Download

http://www.microsoft.com/downloads/details.aspx?FamilyID=F9C1FB79-C903-4842-9F6C-9DB93643FDB7&displaylang=en

Problems

In general the IIS 6 Manager for XP works well but you will find that every time you open it it shows you your local XP's IIS configuration and if you have added an IIS 6 Server and then closed the Manager your settings are lost when you reload.

The way around this problem is to perform the following:

  • Select Start-Run
  • Enter "MMC" and hit Enter
  • Click the "File" menu and select "Add/Remove Snap-in"
  • Click the "Add" button
  • Scroll down the list and select "Internet Information Services (IIS6) Manager" and click Add
  • Click Close
  • Click OK
  • Right click on "Internet Information Services (IIS6) Manager" under the Console Root node and select "Connect"
  • Enter the name of your IIS6 machine (use "Connect as" if needed)
  • Select "File - Save As..." and browse to "c:\document and settings\All Users\Start Menu\Programs\Administrative Tools"
  • Enter "Internet Information Services (MINE)" and click Save
  • Click File - Exit

Now you should find the new menu item "Internet Information Services (MINE)" under Administrative Tools.

When you load it you will find that it contains the local machine and the remote machine's details that you added.

You can keep adding other machines to this configuration - just remember to click File-Save and you settings will be saved.


FTP User Editor for Microsoft Active Directory (Updated)

The FTP User Editor for Microsoft Active Directory has been updated a fix a couple of problems.

Bugs

  • The connect dialog did not hide the password as you typed it!
  • The Recent Users were lost after you shutdown due to a difference in implementation between the old and new controls.

New Features

  • You can now browse to find the path for the FTP Root directory.

You can download and install from:

For more details on the FTP User Editor please see the original post at http://blog.crowe.co.nz/archive/2006/02/15/556.aspx


FTP User Account Editor for Active Directory

FTP User Editor for Microsoft Active Directory.....

What is this?

When you run the FTP server with Microsoft IIS 6.0 on the Windows 2003 Server Family of products you can have the FTP server isolate users to their own folders. This means that the user can not browse into another users folder.

There are three isolation modes:

  1. Do not isolate users
  2. Isolate Users
  3. Isolate Users with Active Directory

This application is designed for option 3 and allows you to edit two attributes for a users account:

  • msIIS-FTPRoot
  • msIIS-FTPDir

For more details on these attributes see the following page.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/a_msiis_ftproot.asp

There is no Windows UI to perform this step but there is a way to edit these attributes using the IISFTP.vbs script that is installed when you install IIS with the FTP Service in IIS 6.

The IISFTP.vbs script works fine but sometimes it is nicer and simpler to have a UI to help perform these steps. You also can see potential problems easier with a Windows UI.

The Application

This application has been written to in c# and requires the .NET Framework 2.0 (the new framework) to function. Windows 2003 Server Family by default installs the .NET Framework 1.1.

The .NET Framework 2.0 redistributable can be downloaded from this page and is approx 22MB

http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en

You can then download and install this application from the URL below.

http://blog.crowe.co.nz/Attachments/FTPUserEditor/setup.msi

After you install the program a new item will be added to your Start - Programs folder called IIS Tools.

When you run the application it will prompt you for a Windows Active Directory domain to log onto. You can log on with the currently logged on user account or you can specify another account to log on with.

Once you log on you are then shown a tree of Folders and Organizational Units (OUs). Click on a node will display all user accounts in that folder or OU.

You can select one or more users and right click and select Edit which will bring up the User Editor dialog.

This dialog allows you to set or clear the attributes that are required for users to log on to the FTP server.

If you have any comments on this application ( or bug reports ) please let me know at iismvp2005@iisfaq.homeip.net

Cheers

Chris Crowe [ IIS MVP 1997 -> 2006 ]
http://www.microsoft.com/windows2000/community/mvp/bios/crowe.mspx

Additional references

Hosting Multiple FTP Sites with FTP User Isolation (IIS 6.0)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b63de8ef-e3c5-456d-a8ca-7af4198819d4.mspx


Microsoft SMTPDiag

SMTPDiag issues DNS queries using both User Datagram Protocol (UDP) and Transmission Control Protocol (TCP) to validate that the queries will succeed. Versions of Windows before Microsoft® Windows® Server™ 2003 and Microsoft Windows® XP did not support UDP queries. If TCP queries fail, mail will not be delivered successfully.

The first thing that SMTPDiag does after verifying syntax is to check the Start of Authority (SOA) record for the remote address domain. The next step is to validate that the local domain MX/A records are resolvable. This test verifies that the sender domain is valid and any bounces can return to the originating server. This test could fail if the domain is not resolvable from inside the firewall. The remote domain MX/A records are then checked also. If this step fails, mail will not route because of issues with DNS. At this point, the network DNS infrastructure must be investigated.

When all the DNS records have been successfully queried, the tool will try to connect to all the MX (mail exchange) records that were published for the remote domain on port 25 and try to do an EHLO, mail from, rcpt to, and quit command.

If you use the verbose (/v) option when you run the tool, more information will be provided about what each test is doing, as well as detailed results of each test step.

Usage

SMTPDIAG "sender address" "recipient address" [-d target DNS] [/v]

 

Argument Function
sender address Required. Address of a local mailbox. Used to verify SMTP submission and check inbound DNS.
recipient address Required. E-mail address of remote mailbox you are trying to send mail to. Used to verify DNS, and remote mailbox availability.
-d target DNS Optional. IP address of target DNS server to use to look up remote MX (mail exchange) records for testing. This is often configured as an external DNS server in Exchange. The external DNS setting is not available for Internet Information Services (IIS) SMTP.
/v Optional. Displays additional information about each test.
/? Displays Help

Diagnostics

Results are displayed in four colors, as follows:

  • White text indicates action being taken. (in the sample below it is Bold Purple)
  • Gray indicates informational results (in the sample below it is Black).
  • Green indicates a successful test result.
  • Red indicates a failed test result.

Example

Searching for Exchange external DNS settings.
Computer name is CHRIS.

Checking SOA for domain.com.
Checking external DNS servers.
Checking internal DNS servers.

Checking TCP/UDP SOA serial number using DNS server [192.168.2.2].
TCP test succeeded.
UDP test succeeded.
Serial number: 2005120602

Checking TCP/UDP SOA serial number using DNS server [200.97.33.1].
TCP test succeeded.
UDP test succeeded.
Serial number: 2005120602

Checking TCP/UDP SOA serial number using DNS server [200.96.152.4].
TCP test succeeded.
UDP test succeeded.
Serial number: 2005120602

Checking TCP/UDP SOA serial number using DNS server [200.96.152.12].
TCP test succeeded.
UDP test succeeded.
Serial number: 2005120602
SOA serial number match: Passed.

Checking local domain records.
Starting TCP and UDP DNS queries for the local domain. This test will try to validate that DNS is set up correctly for inbound mail. This test can fail for 3 reasons.

Local domain is not set up in DNS. Inbound mail cannot be routed to local mailboxes.

Firewall blocks TCP/UDP DNS queries. This will not affect inbound mail, but will affect outbound mail.

Internal DNS is unaware of external DNS settings. This is a valid configuration for certain topologies.

Checking MX records using TCP: domain.com.
      MX: mail.domain.com (5)
      MX: mx1.iserve.net.nz (10)
      A: mail.domain.com [200.79.73.229]
Checking MX records using UDP: domain.com.
      MX: mail.domain.com (5)
      MX: mx1.iserve.net.nz (10)
      A: mail.domain.com [200.79.73.229]
      A: mx1.iserve.net.nz [202.191.32.2]
      A: ns1.iserve.net.nz [202.191.32.1]
      A ns2.iserve.net.nz [202.191.33.1]

Both TCP and UDP queries succeeded. Local DNS test passed.

Checking remote domain records.
Starting TCP and UDP DNS queries for the remote domain. This test will try to validate that DNS is set up correctly for outbound mail. This test can fail for3 reasons.

Firewall blocks TCP/UDP queries which will block outbound mail. Windows 2000/NT Server requires TCP DNS queries. Windows Server 2003 will use UDP queries first, then fall back to TCP queries.

Internal DNS does not know how to query external domains. You must either use an external DNS server or configure DNS server to query external domains.

Remote domain does not exist. Failure is expected.

Checking MX records using TCP: domain.com.
      MX: mail.domain.com (5)
      MX: mx1.iserve.net.nz (10)
      A: mail.domain.com [200.79.73.229]
Checking MX records using UDP: domain.com.
      MX: mail.domain.com (5)
      MX: mx1.iserve.net.nz (10)
      A: mx1.iserve.net.nz [202.191.32.2]
Both TCP and UDP queries succeeded. Remote DNS test passed.

Checking MX servers listed for chris.crowe@domain.com.
Connecting to mail.domain.com [200.79.73.229] on port 25.
Received:
220 iisfaq.domain.net Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Thu, 19 Jan 2006 08:03:32 +1300

Sent:
ehlo domain.com
Received:
250-iisfaq.domain.net Hello [192.168.2.1]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK

Sent:
mail from: <chris@domain.com>

Received:
250 2.1.0 chris@domain.com....Sender OK

Sent:
rcpt to: <chris.crowe@domain.com>

Received:
250 2.1.5 chris.crowe@domain.com

Sent:
quit

Received:
221 2.0.0 iisfaq.domain.net Service closing transmission channel

Successfully connected to mail.domain.com.
Connecting to mx1.iserve.net.nz [202.191.32.2] on port 25.Received:
220 mx1-2.iserve.net.nz ESMTP

Sent:
ehlo domain.com

Received:
250-mx1-2.iserve.net.nz
250-PIPELINING
250-8BITMIME
250 SIZE 20971520

Sent:
mail from: <chris@domain.com>

Received:
250 ok

Sent:
rcpt to: <chris.crowe@domain.com>

Received:
250 ok

Sent:
quit

Received:
221 mx1-2.iserve.net.nz

Successfully connected to mx1.iserve.net.nz.


Microsoft IIS tools have been updated...

Microsoft has released the January 2006 IIS toolkit.

  • Fetch 1.4:  Remove the browser from scenario and make raw custom HTTP/S requests to your IIS Web Server
  • Debug Diagnostics 1.0:  Track down problems with IIS Crashes, Hangs, or Memory Leaks using this tool
  • Trace Diag:  This is a combined toolset aimed at helping users of Windows Server 2003 Service Pack 1’s tracing easier.  It includes IISREQMON, IISTRACE for the command-line and IIS Request Viewer (User Interface) and installs only on SP 1 and higher versions of Windows. 

This release also included some updates to SSLDiag to version 1.1.  This included support for the following:

  • Service Pack 1’s Host Header support for SSL
  • SelfSSL complete functionality on the command-line (ssldiag /selfssl)
  • Limit diagnostics with User Interface to single site (for use on large or specific diagnostic situations – ssldiag /s:<siteid>)

 **Important:  Log Parser 2.2, SMTPDiag 1.0, and AuthDiag 1.0 were unchanged in this release.

 

For details about each platform, please use the following URL:

 

  (x86) Landing: http://www.microsoft.com/downloads/details.aspx?FamilyID=9BFA49BC-376B-4A54-95AA-73C9156706E7&displaylang=en

  (x64) Landing: http://www.microsoft.com/downloads/details.aspx?FamilyID=7e42b310-b2d1-496b-8005-9d91782b9995&DisplayLang=en

  (ia64) Landing: http://www.microsoft.com/downloads/details.aspx?FamilyID=13c1c5e5-592c-45bc-b5bb-c486b43eb539&DisplayLang

 


Microsoft Availability Reporting Management Pack for Microsoft Operations Manager 2005
The Microsoft Operations Manager 2005 Availability Reporting Management Pack collects and analyzes data for Microsoft SQL Server, Exchange, IIS, AD, it uses the event logs of your servers, and generates reports that you can study to improve server availability and reliability. You can identify the causes for planned and unplanned downtime and take preemptive actions to decrease downtime in the future.

Availability Reporting uses a number of metrics to provides data that you can view and customize to suit the needs of your IT organization. Each type of report includes tables or graphs with information about the availability and reliability of servers in your environment. You can input parameters, such as specific periods of time, to filter the data presented in the reports.

Availability Reports provide detailed and specific availability and reliability information for several Microsoft applications. For applications not currently supported, Availability Reporting provides basic availability and reliability statistics at the operating system level. In such cases, Availability Reporting measures whether the operating system is running but does not measure whether applications are running.
 

IIS Metabase References

The following Microsoft Sites contain details on the IIS Metabase properties

Metabase Property Reference (IIS 5.0)
http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/apro3usl.htm?id=354

Metabase Property Reference (IIS 6.0)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/cde669f1-5714-4159-af95-f334251c8cbd.mspx


Windows Deployment and Resource Kits Online

Below are a list of the Microsoft Resource Kits that are available online.

Internet Information Services (IIS) 6.0 Resource Guide
This searchable technical reference provides information about running IIS as a Web application platform, ensuring that IIS stays secure, monitoring and tuning IIS, administering the server programmatically, and capitalizing on built-in IIS scalability features to manage large-scale deployments.

Internet Information Services (IIS) 6.0 Resource Kit Tools
The IIS 6.0 Resource Kit Tools can help you administer, secure, and manage IIS. Use them to query log files, deploy SSL certificates, employ custom site authentication, verify permissions, troubleshoot problems, migrate your server, run stress tests, and more.

Internet Information Services (IIS) 6.0 Deployment Guide
Get a prescriptive, task- and scenario-based guidance to help you design and deploy an IIS 6.0 solution–be it a new installation, upgrade, or migration–within your organization. Deploying Internet Information Services (IIS) 6.0 is available as part of the Microsoft Windows Server 2003 Deployment Kit.


Microsoft Windows Server 2003 Resource Kit: Special Promotional Edition
Get the definitive resource for Windows Server 2003, filled with practical guidance on managing and tuning system performance to help optimize speed, reliability, and efficiency.

Windows Server 2003 Technical Reference
Looking for The Microsoft Windows Server 2003 Resource Kit? See the Windows Server 2003 Technical Reference documentation, which provides comprehensive information about the technologies included in the Microsoft Windows Server 2003 operating system. This set of Technical Reference documentation is designed to assist IT planners and administrators by providing the foundational information about the technology components of the operating system.

Windows Server 2003 Deployment Kit
The Microsoft Windows Server 2003 Deployment Kit provides guidelines and recommended processes for designing and deploying Windows Server 2003 technologies to meet your business needs and IT goals.

Migrating from Microsoft Windows NT Server 4.0 to Windows Server 2003
The Migrating from Microsoft Windows NT Server 4.0 to Microsoft Windows Server 2003 guide is designed for IT administrators in small- and medium-sized organizations. It provides guidelines for the migration of domain controller, DHCP/WINS server, file/print server, remote access server, and Web server roles from Windows NT 4.0 to Windows Server 2003.

Windows Server 2003 Resource Kit Tools
The Resource Kit Tools are a set of software tools for network administrators, developers, and power users to manage TCP/IP, networks, the registry, security, remote administration, configuration, batch files, and many other areas of the Windows Server 2003 operating system. To install the tools, download and run Rktools.exe.

Windows XP Professional Resource Kit Documentation
Windows XP Professional Resource Kit Documentation helps IT professionals deploy, manage, and support the Windows XP operating system. In addition to this free online version of the printed book, Windows XP Professional Resource Kit Documentation is available in print from Microsoft Press.

Windows 2000 Resource Kits
From the Windows 2000 Resource Kits home page, you can view Windows 2000 Resource Kit books and references online, review extensive information about deploying Windows 2000, download free tools, and buy the Windows 2000 Resource Kits.

Windows 2000 Resource Kit Tools
These tools help you streamline administrative tasks such as managing Active Directory, administering security features, working with Group Policy and Terminal Services, automating application deployment, and other important jobs. This page contains updated versions of the most popular and useful Resource Kit tools.

Web Resources Page
These resources are referenced in the Windows Resource Kits and lead to information that is useful to Windows users.

Other Microsoft Resource Kits
Get easy access to product Resource Kits here.


IIS - Internet Information Services (IIS) 6.0 Manager for Windows XP
With IIS 6.0 Manager for Windows XP, administrators can remotely manage an IIS 6.0 server from a Windows XP Professional workstation. This tool only installs a snap-in for Microsoft Management Console and its associated DLLs and documentation; it does not install the complete IIS 6.0 server on your local computer.
  • This tool is available only in English. When installed on non-English editions of Windows XP, IIS 6.0 Manager, documentation, folders, and shortcuts appear as English-only.
  • After installation, IIS 6.0 Manager and IIS 5.1 Manager coexist in separate directories on the same computer.

  • Start the IIS 6.0 Manager after installation from the administrative tools folder in the Control Panel, not from the Computer Management console. If the IIS 5.1 Manager is also installed, it will appear in the Computer Management console, not the IIS 6.0 Manager.

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=f9c1fb79-c903-4842-9f6c-9db93643fdb7&DisplayLang=en


IIS : Internet Information Services 6.0 Migration Tool
The Internet Information Services 6.0 Migration Tool is a command line tool that automates several of the steps needed to move a Web application from IIS 4.0, IIS 5.0 or IIS 6.0 to a clean installation of Internet Information Services (IIS) 6.0. The tool transfers configuration data, Web site content, and application settings to a new IIS 6.0 server. Migrating applications to IIS 6.0 enables organizations to take advantage of the new fault-tolerant architecture available in IIS 6.0 and other features that increase Web server reliability, performance, and security.

Update: A new version of the IIS 6.0 Migration Tool (iismt.exe) has been released to correct problems in version 1.0 of the tool. The follow problems with IISMT.exe have been addressed in this new version:

IIS cannot spawn new worker processes during a migration.
Cause: If the Migration is performed to a live production IIS6 server, existing sites may not serve properly until the migration completes. This behavior was because the migration tool locks the metabase during the migration. In the new version the the migration tool does not lock the metabase and hence existing sites on the destination server will continue to serve during the migration.

Permissions of the AdminACL for the W3SVC/<siteID> in the IIS 6.0 metabase are incorrect after migration.
Cause: The migration tool did not migrate the AdminACL correctly for the W3SVC/<siteID>. This resulted to web applications not functioning on the target IIS 6 server. Users may get "500 Internal Server Error" when browsing the migrated ASP web application or "Server Application is Unavailable" when browsing the migrated ASP.NET application.

Migration Tool does not migrate nested applications correctly.
Cause: The migration tool did not migrate nested application properly. The AppRoot metabase key is migrated as (/LM/W3SVC/<ID of site on source>/Root/....) instead of (/LM/W3SVC/<ID of site on Target>/Root/....) which resulted to web application not bering served. Users may get "500 Internal Server Error" when browsing the migrated ASP web application or "Server Application is Unavailable" when browsing the migrated ASP.NET application.
A new version of the IIS6 Migration Tool (version 1.1) has been released to address the above issues.

Note: All versions of the IIS Migration Tool have the following known limitations:
• If you are migrating from NT4 with FPSE 98, and you choose to migrate with /fpse switch, it is possible that the Server Extensions will not function properly on IIS6 as they were on IIS4. The only recommended workaround is to upgrade to FPSE 2000 or FPSE 2002 on the source server (NT4) before beginning the migration.
• The migration can be performed for only one individual site at a time, if you want to migrate the entire IIS server. You may want to put all the migration commands in a batch or script file.
• Files that are located in a directory structure that exceeds MAX_PATH are not migrated. The migration tool will error out with "Access Denied" and stops the migration.
• If you migrate the same site twice and the administrators group does not have full control permission on the source content, the migration tool will error out the second time with an "Access Denied" error. To workaround this, you can either give the administratorsgroup full control on the source content or delete the content on the destination server before you run the migration the second time.

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2aefc3e4-ce97-4f25-ace6-127f933a6cd2&DisplayLang=en


IIS Diagnostics Kits

The IIS Diagnostics Toolkit is a combined release of popular tools used by today's IIS users. These tools include tools aimed at resolving problems related to Secure Socket Layer (SSL) issues, permission or security problems, gathering data for your SMTP server included with IIS, as well as the famous Log Parser utility used to sift through hundreds or thousands of log files very quickly.

The toolkit consolidates all the tools into a convienant download and is supplemented by updates every 90-days to ensure that users have the most current diagnostics tools at their fingertips.

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9bfa49bc-376b-4a54-95aa-73c9156706e7&DisplayLang=en


Authentication and Access Control Diagnostics 1.0 (more commonly known as AuthDiag) is a tool released by Microsoft aimed at aiding IT professionals and developers at more effectively finding the source of authentication and authorization failures.

These users have often seen behavior from Internet Information Services (IIS) that doesn't seem appropriate or random when users authenticate to the IIS server. The complex world of authentication types and the various levels of security permissions necessary to allow a user to access the server causes many hours of labor for those tasked with troubleshooting these problems.

AuthDiag 1.0 offers a robust tool that offers a efficient method for troubleshooting authentication on IIS 5.x and 6.0. It will analyze metabase configuration and system-wide policies and warn users of possible points of failure and guide them to resolving the problem. AuthDiag 1.0 also includes a robust monitoring tool called AuthMon designed at capturing a snapshot of the problem while it occurs in real-time. AuthMon is robust and specially designed for IIS servers removing any information not pertinent to the authentication or authorization process.

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=e90fe777-4a21-4066-bd22-b931f7572e9a&DisplayLang=en


A common problem for administrators of IIS servers is configuring and troubleshooting SSL enabled websites. To assist in administrators efforts, Microsoft has designed a tool - SSL Diagnostics - to aid in quickly identifying configuration problems in the IIS metabase, certificates, or certificate stores.

This tool allows users to review configuration information in a easy to read view mode or to run the tool silently with only the creation of a log file. During use, administrators can simulate the SSL handshake to find errors. They can also quickly "hot swap" certificates for testing purposes.

These packages come in two forms: Express and Full. The express will only give the pertinent tools for administrators to use SSL Diagnostics while full install installs the same files with the appropriate documentation. Included in the full install is a SSL Frequently Asked Questions that can assist in the learning of SSL for administrators

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=cabea1d0-5a10-41bc-83d4-06c814265282&DisplayLang=en


The IIS 6.0 Resource Kit Tools can help you administer, secure, and manage IIS. Use them to query log files, deploy SSL certificates, employ custom site authentication, verify permissions, troubleshoot problems, migrate your server, run stress tests, and more.

The following tools are available in this package:

  • IIS 6.0 Migration Tool Version 1.0 Version 1.1 Now Available!
  • Apache to IIS 6.0 Migration Tool Version 1.0
  • CustomAuth Version 1.0
  • IISCertDeploy.vbs Version 1.0
  • IIS Host Helper Service Version 1.0
  • IISState Version 3.0
  • Log Parser Version 2.1 Version 2.2 Now Available!
  • Metabase Explorer Version 1.6
  • Permissions Verifier Version 1.0
  • RemapUrl Version 1.0
  • SelfSSL Version 1.0
  • TinyGet Version 5.2
  • Web Capacity Analysis Tool Version 5.2
  • WFetch Version 1.3

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en


IIS - Internet Information Server Management Pack for MOM 2005

The Microsoft Internet Information Services (IIS) Management Pack provides availability, health, and configuration monitoring of IIS and its related services.

By monitoring the applications and Web sites running on IIS, this Management Pack highlights issues that cause downtime or poor performance, such as broken links, unavailable sites, and security breaches.

The IIS Management Pack also collects performance analysis and capacity planning data by tracking application performance and user load.

The Microsoft Windows Internet Information Services Management Pack Guide describes the content of the management pack, and describes how to deploy it.

You can download the management pack guide from the Microsoft Web site:
http://www.microsoft.com/downloads/details.aspx?FamilyId=F2049784-923D-4A33-B377-C39CE94A193B\

For more details see:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9451088D-87DE-42E9-8FD3-F005A184DD65&displaylang=en


IIS - Scripts for managing Internet Information Server
 

If you are looking to manage IIS using scripts instead of having to use the GUI the following resources may be helpful to you.

Scripts hosted on www.iisfaq.com - written mostly by me in VBScript using ADSI for IIS 4+

Backup and Restore

How do I backup the Metabase using a script?
How to get a listing of all the Metabase backups that have been made?

Content Indexing

Enum if a web site folders are enabled/disabled for content indexing

Custom Headers

How to add an entry to the CustomHeaders?
How to view the CustomHeaders defined for a specific web site?

FTP

How can I get a simple listing of the FTP Sites on my Web Server
How do I add a new FTP site using ADSI?
How to find the default logon domain for an FTP site?
How to set the default logon domain for an FTP Site?
Is there a way to force the FTP filenames to appear in lowercase?
makeFTPDirsFromTextFile.vbs

IP Address

Changing the IP Address of a large number of Web Sites which are configured using Host Headers
How can I change the IP Address on a particular web site?
How can I export my list of IP And Domain name restrictions from a website?
How can I set 2000 IP address and domain name restrictions?
How do I add multiple IP Addreses to my Web Site?
How do I list all the web sites and the IP addresses associated with each web site?
I get a message "A duplicate name exists on the network" how do I find what site is the duplicate?
I have 100 IP Addresses and would like a script to tell me which IP address to use next.
I have about 50 websites on a NT 4 server that I need to change the IPaddress for each due to IP address changes.

ISAPI Filters

How do I add an ISAPI filter to my Web Site using a Script?
How do I know what custom ISAPI filters are defined on my Web Sites?
More details on ISAPI Extensions and Filters

 Log Files

How can I delete all files from my IIS log file directory that are over 90 days old?
How can I find out all the log options that have been set?
How can I find out what files are in my IIS log directory for a particular web site?
How can I get a listing of all the log file directories and if they exist or not?
How can I set the Log File Directory?
How do I find all the available web site logging formats available?
I have a lot of log files on my system how can I archive them easily?
I see how to change, read, write browse in the directory tab, but I can't find anything about the 'Index this resource' box?
This script will export relevant IIS settings to a log file that you can import into MSAccess or MS Excel.

MIMEMAP

How can I add an entry to the MIMEMAP?
How can I delete an entry from the MIMEMAP?
How can I disable caching of specific file types?
How can I display the items in the MIMEMAP?

Misc Scripts

Do do I add or remove a Script Mapping?
How can I determine from within my script if IIS is version 4 or Version 5?
How can I determine if a web site or virtual directory points to a specific physical path?
How can I enable pass through authentification on IIS5?
How can I find all the properties available for an IIS ADSI object?
How can I set the application protection level - such as Low (InProcess), Medium (Pooled) or High (Out Of Process)?
How do I find all the invalid paths in my web server?
How do I read a web page from the server and then show it to the user?

Passwords and Authentication

How can I find out the password for the IUSR_Computername account?

Scripting DNS Zones and Resource Records

HowTo: Scripting DNS entries in Windows 2000

SMTP

How can I find the files in the SMTP service BADMAIL folder?
How can I find the files in the SMTP service PICKUP folder?
How can I find the files in the SMTP service QUEUE folder?
How to change the SMTP banner on Windows 2000
I am using the IIS Smtp service, how can I get a listing of undelivered messages?

User Accounts

How to Change the Display Names of Active Directory Users with Active Directory Services Interface Script
This article describes how to change the display names of Active Directory users with Active Directory Services Interface (ADSI) script.

Virtual Directories

How can I create a virtual directory and create an ASP application root at the same time?
How can I delete a virtual directory?
How can I view all virtual directory paths for a web site.

Web Sites

How can I create a web site with multiple host headers?
How can I delete a web site using ADSI?
How can I determine the number of sites I have such as Web and FTP on my server?
How can I display the Custom Errors defined for my Site?
How can I find a web site by Host Header name?
How can I get a listing of which sites are started or stopped?
How can I get a simple listing of the web sites and their home directories?
How can I get a simple listing of the web sites on my Web Server?
How can I retrieve/display the IIS Application name from a script?
How can I set my site so it can not be deleted in the MMC?
How can I set the application protection for a web site?
How can I view all the web site root directory paths?
How do I add a new default document to a Web Site?
How do I change the REALM what is displayed when in a Logon Dialog?
How do I create a web site, and an FTP site, and a EMAIL, and configure Front Page Server Extensions?
How do I enable document footers using a script?
How do I enumerate the physical and virtual folders on a particular IIS web site?
How do I find the next available Instance ID for a web site in the IIS Metabase?
How do I make sure that all web sites are running?
How do I start and stop one web site?
How do I unload an IIS Application?
HowTo: Create a virtual directory from an ASP page.
I manage more than 2000 sites with IIS, how can I tell which sites are running out of process?
This DLL enables you to install a website and a filter in IIS4 from InstallShield. The DLL uses ADSI and includes the C++ source


Microsoft Script Repository: Internet Information Server 5.x

Applications and Application Pools
Sample scripts for creating, deleting, and modifying application and application pools for Internet Information Server 5.0 and 5.1.

Basic Administration
Sample scripts for basic administration (such as backing up and restoring the metabase) of Internet Information Server 5.0 and 5.1.

Compression
Sample scripts for managing file compression on Internet Information Server 5.0 and 5.1.

FTP Sites
Sample scripts for managing FTP sites on Internet Information Server 5.0 and 5.1.

Web Sites
Sample scripts for managing Web sites on Internet Information Server 5.0 and 5.1.

Microsoft Script Repository: Internet Information Server 6.0

Applications and Application Pools
Sample scripts for creating, deleting, and modifying application and application pools for Internet Information Server 6.0.

Authentication
Sample scripts for managing authentication properties on Internet Information Server 6.0.

Basic Administration
Sample scripts for basic administration (such as backing up and restoring the metabase) of Internet Information Server 6.0.

BITS Server
Sample scripts for managing the BITS Server that ships with Internet Information Server 6.0.

Certificates
Sample scripts for managing certificate properties on Internet Information Server 6.0.

Compression
Sample scripts for managing file compression on Internet Information Server 6.0.

Filters
Sample scripts for managing filter properties on Internet Information Server 6.0.

FTP Sites
Sample scripts for managing FTP sites on Internet Information Server 6.0.

IMAP Server
Sample scripts for managing the IMAP mail server included with Internet Information Server 6.0.

Logging
Sample scripts for logs and logging options on Internet Information Server 6.0.

NNTP Server
Sample scripts for managing the NNTP news server included with Internet Information Server 6.0.

POP3 Server
Sample scripts for managing the POP3 mail server included with Internet Information Server 6.0.

SMTP Server
Sample scripts for managing the SMTP mail server included with Internet Information Server 6.0.

Web Sites
Sample scripts for managing Web sites on Internet Information Server 6.0.


IIS - Application Pool Architecture Interactive Simulation

I just found this resource today although it has been released since 2003. 

This interactive demonstration shows how Internet Information Services (IIS) 6.0 manages and monitors Web server functionality. By providing control to administrators and automating various functions, IIS 6.0 helps to keep applications and sites running without reactive administrative supervision.

Internet Information Services 6.0 - Application Pool Architecture Internet Information Services (IIS) 6.0 utilizes the Application Pool configuration tool to provides administrators with powerful application pool monitoring and management. Health monitoring enables IIS 6.0 to monitor application pools and restart them if a pool fails. Recycling keeps troublesome applications functioning without administrative supervision. Administration also becomes more cost-effective, because performance options, such as idle timeouts, conserve Web server resources, allowing more sites to be hosted on a single server. Rapid fail protection keeps repeatedly failing applications from impacting other sites running on the server.

To see more http://www.microsoft.com/windowsserver2003/techinfo/training/iis.mspx

Note: Requires installation of an ActiveX control


IIS - [Commercial] Attenuate for IIS
Attenuate is an 'add-on' for Microsoft's Internet Information Server (IIS). Attenuate facilitates the imposition of a variety of bandwidth constraints (throttling) without rejection of service. These include:
  • Total server download rate.
  • Total server upload rate (asp).
  • Individual (connection) upload rate.
  • Rule based assignment of download rate constraints. Rules are specified as wild-card strings. Constraints can be specified as both/either connection or total.

Examples of use include limiting download rates of .zip and .exe files on a per directory basis, limiting .jpeg and .gif download rates sitewide, and preserving bandwidth where streaming media is used. These techniques permit valuable server capacity to be stretched.

For more details see http://www.tcpdata.com/att_overview.shtml


IIS - Using WMI and VBScript to Change HTTP Compression Settings in IIS 6

I found an interesting piece of code online for adjusting the IIS compression settings in IIS 6 using WMI and VBScript on WindowsITPro - although you must be a registered user you can download the code.

See http://www.windowsitpro.com/WindowsScripting/Article/ArticleID/44335/44335.html

Or just incase the code is gone click here


Custom Property Page for Active Directory User and Computers to manage IIS FTP Home Directories and FTP Root Directories

I have been working on a C++ project to create a new property page that will show up in Active Directory Users & Computers when you view the properties of a user account. This new property page will allow you to edit the FTP Root (msIIS-FTPRoot) and FTP Directory (msIIS-FTPDir) for users so that if you have configured the IIS FTP Service to run using Active Directory Isolation Mode you can simply use the GUI to view or modify these attributes.

For more details on these Active Directory attributes see the following:

This is the custom property page as of today (August 9, 2005). I plan to release the source code to this add in and also a compiled binary. I would really like to have a setup.exe application that can install it and configure active directory to use the new property page. Currently this is done manually by editing the Active Directory using a tool (adsvw.exe) that is included with the Active Directory SDK.

Please let me know if you think this is a worth while project and if you think it could use any extra features. I am not sure when I will release the code because I really want to make sure there are no bugs. It is currently working fine, but I need to test it on a Windows 2000 Active Directory Server that does not have the Schema Additions added to it.

So things to do:

  • Make sure there are no bugs in the code & comment the code.
  • Test on Windows 2000, Windows 2000 SBS, Windows 2003, Windows 2003 SBS (done)
  • Write a setup application to install DLL onto server.
  • Write a setup that can configure Active Directory to use the new property sheet.
  • Do all of this ASAP and release to the public.

Please leave comments.


Running multiple websites on Windows XP Professional

On Windows XP Professional you can only have one web site, the UI will not let you create more than one, but you can actually create more by working with the IIS Metabase.

You can only have one of these web sites active at a time and there are other limitations when using Windows XP such as:

Windows XP Professional Windows 2000 and 2003 Server
10 Simultaneous Connections Unlimited number of connections
1 Virtual Web Site Unlimited number of Virtual Web Sites
Does not support Host Headers (See below for a solution) Full support for Host Headers (WWW Service)
Does not support ODBC logging Full support for ODBC logging
Does not support IP and DNS Restrictions Full support for IP and DNS Restrictions

 

IIS Admin is a small free tool that will allow you to have multiple web sites under Windows XP Professional and simply select which site is the active site. The same limitation of one web site being active is still enforced by IIS but you do get a nice simple way of selecting which site is active.

The utility runs from the System Tray and you add new sites from the simple UI as well.

For more details see - http://www.firstserved.net/services/iisadmin.php

For those time when you really need multiple sites on a non Server product checkout MultiSite Filter Version 2

On Windows 2000 and XP Professional this ISAPI filter will allow you to run multiple sites by  interrogating the host header of the incoming http request and on the outcome of that redirects the request to the relevant place in the filesystem.

For more details see - http://www.hairy-spider.com/multisite.aspx