Since IIS on XP seems to be handling only one site at a time and I have multiple installations of EpiServer for different purposes on my machine I needed a fast way of switching between them.

Sure I could go to the administration console and do it manually, but hey, why waste 30 seconds every time you do it when you can actually batch waste them in a chunk of half an hour to automate it.

so here’s my findings.

The adsutil.vbs is the script you want to get intalled on your system somewhere in the search path. %systemroot% will do.
You will find the script on your XP CD in the \i386 folder. Unpack with the following command:

expand E:\i386\adsutil.vb_ %SystemRoot%\adsutil.vbs

Assuming that E: is your CR-ROM drive.

You can find the user’s reference for the script on the Microsoft page

You may want to make sure that your Episerver is running in the default location by using the following call:

Cscript.exe %SystemRoot%\adsutil.vbs SET /W3SVC/1/ROOT

But since you’re probably having only one web server running on your machine anyway (why would you read it otherwise) probably the only thing you really need to do is:

Cscript.exe %SystemRoot%\adsutil.vbs SET /W3SVC/1/ROOT “C:\Inetpub\MyEPiServer###”

Another great tool I use that’s actually built into windows is reg.exe. this tool actually allows you to modify registry from command line. this was actually my initial approach to changing the path. It didn’t succeed to actually change the IIS root – but still it did the modification to the registry (that IIS just merrily ignored).

reg.exe ADD “HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Virtual Roots” /v “/” /d “C:\Inetpub\MyEPiServer###,,201” /t REG_SZ /f

This is however good for changing some database settings if anything is stored in the registry before restarting the IIS, which is can be scripted as:

net stop W3svc
net start W3svc

So to summarize… my script for switching sites ends as:

@echo off

set root_folder=C:\Inetpub\MyEPiServer2\
set adscript_location=%SystemRoot%\adsutil.vbs

echo Switching IIS to %root_folder%
Cscript.exe %adscript_location% SET /W3SVC/1/ROOT “%root_folder%”
net stop W3svc
net start W3svc

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...



This entry (Permalink) was posted on Wednesday, March 28th, 2007 at 5:15 pm and is filed under ASP.NET, EPiServer, Internet Information Services. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.



  • Nice. There are times when doing this in a script is just the right thing.

    For my everyday-iis-stop-start-tasks I use IISAdmin. You can download it from http://www.codeproject.com/csharp/iisadminnet.asp

    It even lets me create new sites in IIS on XP, which I do if get a site from someone else.

    /Steve

  • Steve, that’s a great tool indeed! I will definitely take a look at it. Although I prefer to have as few tray apps as possible, this may actually be lightweight enough to have it running in the background.

    My motivation behind running a simple batch file is that I do this switching only 2-3 times a day. That’s probably silly but this time of apps usually irritate me the rest of the time as it’s just sitting there wasting resources I could be putting to some actual work. :)

    I’m paranoid and well aware of it.

    One of those guys that use FAR as their file manager.