Moving SharePoint sites off the system drive – changing IIS virtual directories

A good practice is to move IIS off the system drive to another such as D:

Ok, so you tell your Server guys but they miss out on an important step such as updating the registry to the new D:\inetpub… location. You dont check this since you think they know what they are doing and go ahead and install SharePoint and once you are done, you realise that your Central Admin website has been installed and its virtual directory is located on C: – the system drive.

What now?

Step 1. Confirm your suspicions by visiting HKLM\Software\Microsoft\inetstp and checking if your PathWWWRoot points to the system root.

Step 2. Fix IIS by running the script. Click here moveiis7root  to download the txt file and rename to .bat
Usage (where D is the non system drive):  moveiis7root.bat D

I corrected two lines from the original script found at

Step 3. Move Central Admin website to a virtual directory off the system drive.
It is important to note that you had the choice to specify the virtual directory path when creating other SharePoint Web Applications. Once you run Step 2, your default virtual directory path will change to the drive partition you specified.

Changing SharePoint Web Application virtual directories can be done a couple of ways including through the GUI – Central Administration (thats another topic – ask me how if you need info), however the Central Admin Virtual Directory is nicely set since the installation of the farm in the Config Database and is read only and there is no way to successfully do it via the Central Administration.

Here is a PowerShell script that will help you move this to a partition/drive or directory of your choice. You could use it even if you want to tidy up the Central Administration virtual directory number and make it more meaningful if you want.

Click here ChangeVirtualDirectory to download the txt file and rename to .ps1

Usage: Right click, run with PowerShell, enter the URL of the Central Administration site and you will then be prompted to enter the new virtual directory.

The script copies the files over, however you need to modify the Central Admin website in IIS to point to the new virtual directory. Lastly, an IISRESET on the Central Admin box.
Apologies if you have a single server SharePoint farm.

Hope this helps.

1 Comment

  1. Hi I am trying this code over win 2012r2 but it didn’t work , can be please help me how to run this .bat file on window server 2012 r2

Write A Comment