Pages

Tuesday, April 27, 2010

IIS 7 : Change the default location for Inetpub and other folders

To change the path of Inetpub: go to %windir%\system32\inetsrv\appcmd list vdir and to change the path execute
%windir%\system32\inetsrv\appcmd set vdir "Default Web Site/" -physicalPath:

For all folders follow this:
You can xcopy %systemdrive%\inetpub\ to a different partition and then open %windir%\system32\inetsrv\applicationhost.config.

Search for all instances of inetpub and replace the path with your new path.

Now we need to change Schema, These are config entries that are used when not specified in the configuration file (applicationhost.config). The schema defaults are in %windir%\system32\inetsrv\config\iis_schema.xml.

You can also search for inetpub in there. IIS_SCHEMA.XML is a system-file protected, so we can not edit it. We have to make an explicit configuration entry that gets written to applicationhost.config. Here a couple of examples:

How to change the path for the ASP template cache directory default:
%windir%\system32\inetsrv\appcmd set config -section:asp -diskTemplateCacheDirectory:

How to change the default for logfiles:
%windir%\system32\inetsrv\appcmd set config -section:sites -siteDefaults.logfile.directory:

How to change the default for failedRequestLogs:
%windir%\system32\inetsrv\appcmd set config -section:sites -siteDefaults.traceFailedRequestsLogging.directory:

or for the compression cache directory:
%windir%\system32\inetsrv\appcmd set config -section:sites -httpCompression -directory: