Mark Brown

Nota Bene

Scripting the XP IIS single site limitation

The single site limitation in IIS on XP is frustrating. Since I can't have more then one site on the box, I needed a way to quickly change the Home Directory of the root web. To satisfy my need I came up with this little script.

' setw3.vbs
Dim objArgs
Set objArgs = WScript.Arguments

If objArgs.Length = 0 Then

  ' Use the current patch
  Set WshShell=WScript.CreateObject("WScript.Shell")
  Set fs = CreateObject("Scripting.FileSystemObject")
  currentPath = fs.GetAbsolutePathName(".\")

Else

  currentPath = objArgs.Item(0)

End If

Set IISObject = GetObject("IIS://LocalHost/w3svc/1/Root")
IISObject.Path = currentPath
IISObject.Setinfo

I put this script in my path and can call it from the command line or a batch file. 

For example:

w3set “e:\dev\project1“

or a batch file sitting on my Desktop

cd /D e:\dev\project1
w3set

Posted: Jun 16 2004, 07:48 AM by markbrown | with 3 comment(s)
Filed under:

Comments

Justin Lovell said:

I have a few scripts of my own which allows multiple web sites on one box BUT only one can run at a time. FYI, here is my blog post:

http://blogs.aspadvice.com/jlovell/archive/2004/01/22/373.aspx

I find it is so much better because I can different site configurations for each site.

Cheers,
Justin
# June 16, 2004 11:34 AM

Adam Weigert said:

Sweet, I knew we could do this but I never took the time to script it. Glad to see that it is quite simple.
# June 16, 2004 12:57 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)