Many people believe that it is not possible to relocate the IIS file system hive located at C:\InetPub. Well, this is not true. As a matter of fact, it is very easy to specify the location of the InetPub folder to any drive and path that you want. This does have to be performed when you install Internet Information Services (IIS) to the machine. If IIS is already installed, you will have to remove it.

I personally feel that the system partition should be reserved for the operating system and any program executables. All data files should be located on another partition. This will make recovery and disaster planning much easier. I have even made relocating IIS extremely easy by creating a command file that will install IIS into the location you want using a single command line statement. So, if you want, you can easily relocate C:\InetPub\wwwroot -> D:\InetPub\wwwroot – I like D:\Webs myself.

Basically, what you would have to do is create a setup answer file that specifies the components to activate and the locations of the file hives. Once you have created this file, you install IIS using the sysocmgr.exe setup application and reference the answer file that you have created. I have created a command file that will do this for you. All you have to do is run the command file, and as parameters provide the locations for the wwwroot and ftproot paths. This will fire the setup application, install and configure IIS in the location you want. Just make sure that you have access to the Operating System installation files either through a local path, network share, or CD.

To create this command file, open Notepad and paste the text from the area below. Save the file with the name iisreloc.cmd.

You can find out more information about creating the answer file on Microsoft’s website at

If you want to configure IIS during OS installation add the sections generated in the script, or described in the Microsoft document above to your unattended.txt or winnt.sif file.

For Example:

If you wanted to install the IIS hive at D:\InetPub instead of C:\InetPub run the command file using the following syntax:

Iisreloc.cmd D:\InetPub\wwwroot D:\InetPub\ftproot