How-To Move IIS7's Inetpub Directory

For a little added security you can move your inetpub directory to a seperate partition from your operating system files.  By default the IIS7 Inetpub directory is created on the same partition as the Window Server 2008 install.  There is no way to specify a different location during the setup process.  You can create a new inetpub directory on a different partition, set the correct permissions, and change all the IIS settings to point to the new directory.  However, a program manager on the IIS team wrote a great script that will do all that for you.  Here are the steps to move inetpub using his batch file: [more]

  • First download the batch file from his blog post.
  • Unzip the batch file
  • Open a command prompt
  • Browse to the directory where you unzipped the batch file
  • Type "moveiis7root.bat" <the drive letter of the partition you would like to move it to> and press enter

Example: "moveiisroot.bat w"

If the batch file runs successfully you'll have a new inetpub directory on the partition you specified with the correct access permissions set and IIS will be configured to use the new folder.  You can then delete the old c:\inetpub directory.