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.