slb2008
asked on
Move Windows Server 2008 Inetpub directory from default to another drive letter E:\
Dear Experts-Exchange,
I am trying to move C:\Inetpub directory from default directory to a different partition drive D:\, setting the permissions, change all the IIS settings to point to the new directory. I found online this batch file: (see below):
I would like to know what do I need to change in the batch file to make sure :
Do I need to change this line:
reg add HKLM\System\CurrentControl Set\Servic es\WAS\Par ameters /v ConfigIsolationPath /t REG_SZ /d %MOVETO%inetpub\temp\appPo ols /f
to be
reg add HKLM\System\CurrentControl Set\Servic es\WAS\Par ameters /v ConfigIsolationPath /t REG_SZ /d %MOVETO%inetpub\temp\appPo ols /e <-- E drive (?)
echo MOVEIISROOT.BAT F
to be
echo MOVEIISROOT.BAT E <-- E:\Drive
REM PLEASE BE AWARE: SERVICING (I.E. HOTFIXES AND SERVICE PACKS) WILL STILL REPLACE FILES
REM IN THE ORIGINAL DIRECTORIES. THE LIKELIHOOD THAT FILES IN THE INETPUB DIRECTORIES HAVE
REM TO BE REPLACED BY SERVICING IS LOW BUT FOR THIS REASON DELETING THE ORIGINAL DIRECTORIES
REM IS NOT POSSIBLE.
@echo off
IF "%1" == "" goto err
setlocal
set MOVETO=%1:\
REM simple error handling if drive does not exist or argument is wrong
IF NOT EXIST %MOVETO% goto err
REM Backup IIS config before we start changing config to point to the new path
%windir%\system32\inetsrv\ appcmd add backup beforeRootMove
REM Stop all IIS services
iisreset /stop
REM Copy all content
REM /O – copy ACLs
REM /E – copy sub directories including empty ones
REM /I – assume destination is a directory
REM /Q – quiet
REM echo on, because user will be prompted if content already exists.
echo on
xcopy %systemdrive%\inetpub %MOVETO%inetpub /O /E /I /Q
@echo off
REM Move AppPool isolation directory
reg add HKLM\System\CurrentControl Set\Servic es\WAS\Par ameters /v ConfigIsolationPath /t REG_SZ /d %MOVETO%inetpub\temp\appPo ols /f
REM Move logfile directories
%windir%\system32\inetsrv\ appcmd set config -section:system.applicatio nHost/site s -siteDefaults.traceFailedR equestsLog ging.direc tory:"%MOV ETO%inetpu b\logs\Fai ledReqLogF iles"
%windir%\system32\inetsrv\ appcmd set config -section:system.applicatio nHost/site s -siteDefaults.logfile.dire ctory:"%MO VETO%inetp ub\logs\lo gfiles"
%windir%\system32\inetsrv\ appcmd set config -section:system.applicatio nHost/log -centralBinaryLogFile.dire ctory:"%MO VETO%inetp ub\logs\lo gfiles"
%windir%\system32\inetsrv\ appcmd set config -section:system.applicatio nHost/log -centralW3CLogFile.directo ry:"%MOVET O%inetpub\ logs\logfi les"
REM Move config history location, temporary files, the path for the Default Web Site and the custom error locations
%windir%\system32\inetsrv\ appcmd set config -section:system.applicatio nhost/conf igHistory -path:%MOVETO%inetpub\hist ory
%windir%\system32\inetsrv\ appcmd set config -section:system.webServer/ asp -cache.disktemplateCacheDi rectory:"% MOVETO%ine tpub\temp\ ASP Compiled Templates"
%windir%\system32\inetsrv\ appcmd set config -section:system.webServer/ httpCompre ssion -directory:"%MOVETO%inetpu b\temp\IIS Temporary Compressed Files"
%windir%\system32\inetsrv\ appcmd set vdir "Default Web Site/" -physicalPath:%MOVETO%inet pub\wwwroo t
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='401'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='403'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='404'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='405'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='406'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='412'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='500'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='501'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
%windir%\system32\inetsrv\ appcmd set config -section:httpErrors /[statusCode='502'].prefix LanguageFi lePath:%MO VETO%inetp ub\custerr
REM Make sure Service Pack and Hotfix Installers know where the IIS root directories are
reg add HKLM\Software\Microsoft\in etstp /v PathWWWRoot /t REG_SZ /d %mOVETO%\inetpub\wwwroot /f
reg add HKLM\Software\Microsoft\in etstp /v PathFTPRoot /t REG_SZ /d %MOVETO%\inetpub\ftproot /f
REM Do the same for x64 directories
if not "%ProgramFiles(x86)%" == "" reg add HKLM\Software\Wow6432Node\ Microsoft\ inetstp /v PathWWWRoot /t REG_EXPAND_SZ /d %MOVETO%inetpub\wwwroot /f
if not "%ProgramFiles(x86)%" == "" reg add HKLM\Software\Wow6432Node\ Microsoft\ inetstp /v PathFTPRoot /t REG_EXPAND_SZ /d %MOVETO%inetpub\ftproot /f
REM Restart all IIS services
iisreset /start
echo.
echo.
echo ========================== ========== ========== ========== ========== ========== ===
echo Moved IIS7 root directory from %systemdrive%\ to %MOVETO%.
echo.
echo Please verify if the move worked. If so you can delete the %systemdrive%\inetpub directory.
echo If something went wrong you can restore the old settings via
echo "APPCMD restore backup beforeRootMove"
echo and
echo "REG delete HKLM\System\CurrentControl Set\Servic es\WAS\Par ameters\Co nfigIsolat ionPath"
echo You also have to reset the PathWWWRoot and PathFTPRoot registry values
echo in HKEY_LOCAL_MACHINE\Softwar e\Microsof t\InetStp.
echo ========================== ========== ========== ========== ========== ========== ===
echo.
echo.
endlocal
goto success
REM error message if no argument or drive does not exist
:err
echo.
echo New root drive letter required.
echo Here an example how to move the IIS root to the F:\ drive:
echo.
echo MOVEIISROOT.BAT F
echo.
echo.
:success
Your help is very much appreciative. Thanks.
I am trying to move C:\Inetpub directory from default directory to a different partition drive D:\, setting the permissions, change all the IIS settings to point to the new directory. I found online this batch file: (see below):
I would like to know what do I need to change in the batch file to make sure :
Do I need to change this line:
reg add HKLM\System\CurrentControl
to be
reg add HKLM\System\CurrentControl
echo MOVEIISROOT.BAT F
to be
echo MOVEIISROOT.BAT E <-- E:\Drive
REM PLEASE BE AWARE: SERVICING (I.E. HOTFIXES AND SERVICE PACKS) WILL STILL REPLACE FILES
REM IN THE ORIGINAL DIRECTORIES. THE LIKELIHOOD THAT FILES IN THE INETPUB DIRECTORIES HAVE
REM TO BE REPLACED BY SERVICING IS LOW BUT FOR THIS REASON DELETING THE ORIGINAL DIRECTORIES
REM IS NOT POSSIBLE.
@echo off
IF "%1" == "" goto err
setlocal
set MOVETO=%1:\
REM simple error handling if drive does not exist or argument is wrong
IF NOT EXIST %MOVETO% goto err
REM Backup IIS config before we start changing config to point to the new path
%windir%\system32\inetsrv\
REM Stop all IIS services
iisreset /stop
REM Copy all content
REM /O – copy ACLs
REM /E – copy sub directories including empty ones
REM /I – assume destination is a directory
REM /Q – quiet
REM echo on, because user will be prompted if content already exists.
echo on
xcopy %systemdrive%\inetpub %MOVETO%inetpub /O /E /I /Q
@echo off
REM Move AppPool isolation directory
reg add HKLM\System\CurrentControl
REM Move logfile directories
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
REM Move config history location, temporary files, the path for the Default Web Site and the custom error locations
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
%windir%\system32\inetsrv\
REM Make sure Service Pack and Hotfix Installers know where the IIS root directories are
reg add HKLM\Software\Microsoft\in
reg add HKLM\Software\Microsoft\in
REM Do the same for x64 directories
if not "%ProgramFiles(x86)%" == "" reg add HKLM\Software\Wow6432Node\
if not "%ProgramFiles(x86)%" == "" reg add HKLM\Software\Wow6432Node\
REM Restart all IIS services
iisreset /start
echo.
echo.
echo ==========================
echo Moved IIS7 root directory from %systemdrive%\ to %MOVETO%.
echo.
echo Please verify if the move worked. If so you can delete the %systemdrive%\inetpub directory.
echo If something went wrong you can restore the old settings via
echo "APPCMD restore backup beforeRootMove"
echo and
echo "REG delete HKLM\System\CurrentControl
echo You also have to reset the PathWWWRoot and PathFTPRoot registry values
echo in HKEY_LOCAL_MACHINE\Softwar
echo ==========================
echo.
echo.
endlocal
goto success
REM error message if no argument or drive does not exist
:err
echo.
echo New root drive letter required.
echo Here an example how to move the IIS root to the F:\ drive:
echo.
echo MOVEIISROOT.BAT F
echo.
echo.
:success
Your help is very much appreciative. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The script does it for ya :)
REM Stop all IIS services
iisreset /stop
and starts them backup
REM Restart all IIS services
iisreset /start
Hades666
REM Stop all IIS services
iisreset /stop
and starts them backup
REM Restart all IIS services
iisreset /start
Hades666
ASKER
I can see the script does it .That's right. I'll be right back. I am going to start the process of moveIISbatch file.
ASKER
the batch file "moveIISRoot.Bat" file worked like a charm. I have E:\Inetpub\wwwroot .
Thanks so much, hades666. You will get the 500 points.
Thanks so much, hades666. You will get the 500 points.
ASKER
moveIISRoot.bat is a great script batch file .
ASKER