Partager via


Moving IIS7 root to a non-system drive

 

There is a good post by Thomas on moving the IIS7 root directory to a non-system drive.

IIS7: Moving the INETPUB directory to a different drive - https://blogs.iis.net/thomad/archive/2008/02/10/moving-the-iis7-inetpub-directory-to-a-different-drive.aspx 

So all you need to do is to run moveiis7root.bat and provide the target drive. Script will do rest of the magic for you. While this script works like a charm, there is one small issue with it.

It doesn't update root for FTP logs.

Means. if I move IIS root from C: drive to D: drive, I would expect FTP logs to be created in D:\inetpub\logs\LogFiles\FTPSVC<ID>. But this does not happen and IIS will keep generating FTP logs to C:\inetpub\logs\LogFiles\FTPSVC<ID>.

Here is the update to fix this issue

%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.ftpServer.logFile.directory:"%MOVETO%inetpub\logs\logfiles"

%windir%\system32\inetsrv\appcmd set config -section:system.ftpServer/log -centralLogFile.directory:"%MOVETO%inetpub\logs\logfiles"

You can update the script with the above commands and you are good to go.

Comments

  • Anonymous
    December 16, 2013
    Hi Ashish,Will you please also tell how to delete the Inetpub folder from C: drive once running the moveiis7.bat file making the customization you suggested?I am able to copy the inetpub folder to my D; drive however, I cannot delete the inetpub folder from C: drive... I am a novice, please try to explain in step by step...Will heartily thank you for that
  • Anonymous
    March 18, 2014
    You will need to take ownership of the folder and flush down permissions also.