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.