In my previous article we discussed how to perform an automated install of IIS 7 and how to use ServerManagercmd and appcmd to create a standard web server build. This is a continuation of that article, and this time we’ll go over how to put IIS on a non-system drive (something other than C:).
With IIS 6 this was fairly easy to accomplish by using an answer file to perform an unattended install and modifying the PathWWWRoot parameter with whatever drive letter you want the web server to be installed to. So given that Microsoft has repeatedly told their customers (including me) to avoid installing IIS to the system drive, you’d expect that with IIS 7 they’d make this process even easier. Yeah, no… It’s actually much more difficult. With IIS 7 and Windows Server 2008 you can’t install the web server to anything other than the C: drive, so to get IIS on a different drive you have to move it post install.
To accomplish this doesn’t mean simply cutting and pasting the /Inetpub directory, it means changing ALL references in the registry as well as any configurations within IIS itself that are pointing to the C: drive. Initially I set out to create a script to do this and was floored with just how many changes were required. It was messy. Luckily while I was busy banging my head against my desk, Thomas Deml of the Microsoft IIS team came up with a very good looking script that accomplishes everything you need. He even includes a sample copy for you to download. I use his script as part of my own IIS 7 standard build, and would highly recommend that you do the same.
Similar Articles:

August 4th, 2009 at 7:58 AM
Hi Tray,
Great script to move the webroot, unfortunately you have a hardcoded drive letter in it. it has to be
REM Make sure Service Pack and Hotfix Installers know where the IIS root directories are
reg add HKLM\Software\Microsoft\inetstp /v PathWWWRoot /t REG_SZ /d %moveto%inetpub\wwwroot /f
reg add HKLM\Software\Microsoft\inetstp /v PathFTPRoot /t REG_SZ /d %moveto%inetpub\ftproot /f
Instead of
REM Make sure Service Pack and Hotfix Installers know where the IIS root directories are
reg add HKLM\Software\Microsoft\inetstp /v PathWWWRoot /t REG_SZ /d f:\inetpub\wwwroot /f
reg add HKLM\Software\Microsoft\inetstp /v PathFTPRoot /t REG_SZ /d f:\inetpub\ftproot /f