Moving IIS Install from one system drive to another.
So you have a beefy new server with multiple drives. Let’s just say you have a C, D and E Drives just for argument sake. You want to move “all” of your server based applications off the C drive since the operating system drive is typically the first to die crash or be at a loss for data.
IIS is typically by default installed and assigned on the system drive C:\inetpub. However you want to move it to D:\intepub. So you start down the whole copy and paste which may seem like it will work however you still have to touch multiple Registry keys and paths. Well here is a simple script to make your IIS moving a snap. ![]()
Also if you copy this make sure to name the file a .Bat file for Batch… Just in case.
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 errREM Backup IIS config before we start changing config to point to the new path
%windir%\system32\inetsrv\appcmd add backup beforeRootMoveREM Stop all IIS services
iisreset /stopREM Copy all content
REM /O - copy ACLs
REM /E - copy sub directories including empty ones
REM /I - assume destination is a directory
REM /Q - quietREM 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\CurrentControlSet\Services\WAS\Parameters /v ConfigIsolationPath /t REG_SZ /d %MOVETO%inetpub\temp\appPools /fREM Move logfile directories
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.traceFailedRequestsLogging.directory:"%MOVETO%inetpub\logs\FailedReqLogFiles"
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.logfile.directory:"%MOVETO%inetpub\logs\logfiles"
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralBinaryLogFile.directory:"%MOVETO%inetpub\logs\logfiles"
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralW3CLogFile.directory:"%MOVETO%inetpub\logs\logfiles"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.applicationhost/configHistory -path:%MOVETO%inetpub\history
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp -cache.disktemplateCacheDirectory:"%MOVETO%inetpub\temp\ASP Compiled Templates"
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/httpCompression -directory:"%MOVETO%inetpub\temp\IIS Temporary Compressed Files"
%windir%\system32\inetsrv\appcmd set vdir "Default Web Site/" -physicalPath:%MOVETO%inetpub\wwwroot
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='401'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='403'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='404'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='405'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='406'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='412'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='500'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='501'].prefixLanguageFilePath:%MOVETO%inetpub\custerr
%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='502'].prefixLanguageFilePath:%MOVETO%inetpub\custerrREM Make sure Service Pack and Hotfix Installers know where the IIS root directories are
reg add HKLM\Software\Microsoft\inetstp /v PathWWWRoot /t REG_SZ /d %mOVETO%\inetpub\wwwroot /f
reg add HKLM\Software\Microsoft\inetstp /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 /fREM 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\CurrentControlSet\Services\WAS\Parameters\ConfigIsolationPath"
echo You also have to reset the PathWWWRoot and PathFTPRoot registry values
echo in HKEY_LOCAL_MACHINE\Software\Microsoft\InetStp.
echo ===============================================================================
echo.
echo.
endlocal
goto successREM 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
This should take care of your IIS moving needs. Do not forget to reboot to make sure settings are happy.
Commerce Server 2007: Direct Mailer Is Not Working Please Help!
Cannot tell you how much fun this can be if it is not working correctly. First make sure SMTP is set up correctly in your IIS install (IIS6-IIS7.5(which uses IIS6 but thats for another story))
Direct Mailer Not working or not sending email or just needs to be configured correctly?
First lets make sure the server and users/groups are created right.
To grant the Marketing Web Service access to the Direct Mailer Service
1. Click Start, point to Programs, point to Administrative Tools, and then click Component Services.
2. In the Component Services window, expand Component Services, expand Computers, expand My Computer, expand DCOM Config, right-click Microsoft Commerce Server DirectMailer Service, and then click Properties.
3. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, on the Security tab, in the Launch and Activation Permissions section, select Customize, and then click Edit.
4. In the Launch Permission dialog box, click Add.
5. In the Select Users, Computers, or Groups dialog box, in the Enter the object names to select box, type <data domain>\MarketingWebSvc, and then click OK.
6. In the Launch Permission dialog box, in the Permissions for <data domain>\MarketingWebSvc section, select the Local Launch and Local Activation check boxes for Allow, and then click OK.
7. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, on the Security tab, in the Access Permissions section, select Customize, and then click Edit.
8. In the Access Permission dialog box, click Add.
9. In the Select Users, Computers, or Groups dialog box, in the Enter the object names to select box, type <data domain>\MarketingWebSvc, and then click OK.
10. In the Access Permission dialog box, in the Permissions for <data domain>\MarketingWebSvc section, select the Local Access check box for Allow, and then click OK.
11. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, click OK
To grant the Marketing Web Service access to the Direct Mailer Service
1. Click Start, point to Programs, point to Administrative Tools, and then click Component Services.
2. In the Component Services window, expand Component Services, expand Computers, expand My Computer, expand DCOM Config, right-click Microsoft Commerce Server DirectMailer Service, and then click Properties.
3. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, on the Security tab, in the Launch and Activation Permissions section, select Customize, and then click Edit.
4. In the Launch Permission dialog box, click Add.
5. In the Select Users, Computers, or Groups dialog box, in the Enter the object names to select box, type <data domain>\MarketingWebSvc, and then click OK.
6. In the Launch Permission dialog box, in the Permissions for <data domain>\MarketingWebSvc section, select the Local Launch and Local Activation check boxes for Allow, and then click OK.
7. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, on the Security tab, in the Access Permissions section, select Customize, and then click Edit.
8. In the Access Permission dialog box, click Add.
9. In the Select Users, Computers, or Groups dialog box, in the Enter the object names to select box, type <data domain>\MarketingWebSvc, and then click OK.
10. In the Access Permission dialog box, in the Permissions for <data domain>\MarketingWebSvc section, select the Local Access check box for Allow, and then click OK.
11. In the Microsoft Commerce Server DirectMailer Service Properties dialog box, click OK
And verify that your web service identity is a member of the DML_SG group
Prepare the Members and Groups for COM component Services:
Member Manage:
Create the group DML_SG
Add the following users to the:
DML_SG
CSDMSvc
MarketingWebSvc
Add the following users to the:
MarketingAdminGroup
RunTimeUser
MarketingWebSvc
CSDMSvc
Add the following users to the:
Administrator
MarketingWebSvc
Go into services and make sure commerce server direct mailer is running and set to automatic.
Trouble Shooting
You can add the following registry change if these do not work.
Open Registry using regedit.exe.
Navigate to HK_LOCAL_Machine\Software\Microsoft\SchedulingAgent and give full control to NT account under which marketing system is working (or add authenticate users).
*Right click on the key and scroll down to permissions inside permissions add DML_SG and give full permissions.
Test Emailing by scheduling a DML run with dmlrun.exe:
dmlrun.exe /create:type=final;site="Buylifetime.com";id=30 /execute
If that doesn't work, try using the DirectMailer COM object to test your direct mail:
Dim dm
set dm = CreateObject("Commerce.DirectMailer", "<DML Server Name>")
call dm.TestDirectMail("StarterSite", 30)
save and do IIS reset
Last and most effective:
Open a Command Prompt go to (different for 32 and 64 bit servers(Provided is the 64bit version))) C:\Program Files (x86)\Microsoft Commerce Server 2007 Then run:
csconfig /r Feature.MS.CS.DirectMailer
Commerce Server 2007 PUP Check.
So as you all know I am a Non-MVP for Commerce Server 2007 however I have worked tirelessly with this server. I know a ton of the in’s and outs of the architecture and have written a good number of scripts and modified others scripts to work.
Recently I have had the pleasure of making Commerce Server 2007 run (play nice) with Windows Server 2008r2. This was interesting in many many ways to which I will document down the road.
For this post I wanted to share a great little script that helps with your own or the default “PUP” install.
As those of us that have installed Commerce Server 2007 on multiple machines architectures and what not know when installing the “PUP” it is important to keep the “default” web site intact. Also if you can help it, Not to have any other sites running or created in IIS6 - IIS7.5. However you may have some installed and the APP ID’s all randomized (default behavior for IIS (all versions)). The “PUP” installer may have issues with “other” web sites running in IIS.
So to check what may be causing these issues try running my happy little script.
Put the following code into a vbs and run.
'The code below simulates Commerce Server Site Packager checking IIS health.
'This IIS checking happens when you click the "next" button at the first dialog of the Site Unpacking
'This code helps you to find out where the checking failsset oNet=CreateObject("WScript.Network")
sLocalMachine = oNet.ComputerName
Set webServer = GetObject("IIS://" & sLocalMachine & "/w3svc")
msgbox "Web Server "+ sLocalMachine +" has the following Web Sites:"
For Each webSite In webServer
If IsNumeric(webSite.Name) ThensName = webSite.Name
msgbox "Web Instance Number: "+sNamesComment = webSite.ServerComment
msgbox "Web Site Name: "+sCommentFoo = webSite.ServerBindings
msgbox "Port "+Foo(0)Set vroot = webSite.GetObject("IIsWebVirtualDir", "Root")
msgbox "Root: "+vroot.path
End If
Nextset onet=nothing
set webserver=nothing
set webSite=nothing
set vroot=nothing
Enjoy! Let me know how it goes.
FTP User Isolation IIS7.5
I have been using FTP since before IIS was really a leader or even a thought over at the house of M$ (Gangster Geek Term for Microsoft). IIS has always offered a decent FTP server from windows NT to Windows 2003. So it should not have been a chore to install and run FTP on IIS7.5
IIS7.5 is a beautiful web server. Not to the naked eye (gangster Geek term for Non-Geek) but for the web master that loves Apache, Tomcat or IIS * (anything for the non-geek) and of course we wont speak of those other wanna be web server software's out there and you know who you are please go away.
*Now off the soap box*
Anyway the IIS7.5 Gui is pretty and fun. However looks don't mean much unless you have brains. So back to the whole setup and why this post is being written.![]()
Setting up FTP is kind of a chore in IIS7.5. Why I say that is it offers some really awesome features (yes I will spare you the details) FTP has security features that allow it to be an easier setup than in any other IIS version.
Alright so the long and the short of this post is how to setup IIS7.5 to use Isolation mode.
First use a ftproot type folder: C:\inetpub\ftproot will do.
Run this from the command line: “ICACLS “C:\inetpub\ftproot” /grant IUSR:R”
Now under that folder create a folder called LocalUser *make sure to pascal case sensitive (this according to M$)
Then Create a folder called “Public” then create a local user for example: Administrator
Now point your FTP root directory to the C:\inetpub\ftproot
FTP will then pick up and understand that is the directory and will use the appropriate folder setup
When you try to connect to the Ftp using a certain username FTP will Isolate the folder for you.
This is awesome. enjoy your new FTP site.
Hosting Media on IIS6? You will need these MIME types.
Here is how to add two popular types streaming media (Flash and Silverlight).
Flash (flv)
If you are a Adobe geek and use IIS6 and you cannot fiqure out why a .FLV file will not render or you get the evil 404.3 error. Try this:
Flash Streaming MIME:
flv
extension: .flv
MIME type: flv-application/octet-stream
To add the MIME types to IIS6:
1. Choose your website in IIS
2. Open the context menu and choose "Properties"
3. Select the register "HTTP-Header"
4. Click on the button labeled "MIME Types..."
5. If .flv is not yet listed as a type, choose "New"
6. Enter the following description:
Extension: .flvMIME type: flv-application/octet-stream7.
7.Click "Ok",
8. Choose "Apply" and you're set!
Silverlight
If you want to host Silverlight on a web server that isn't IIS7, such as IIS6 which is the second best web server in the world (2nd to IIS7
) you'll need to add the MIME types to support the correct content type interpretation by the browser. In the case of Silverlight this is the XAML content type - this also goes for WPF hosting as well. IIS7 has these MIME types already added but if they're not there this will result in errors such as 404.3 and prompting to download etc.
There are 3 MIME types required
To add the MIME types to IIS6:
1. Choose your website in IIS
2. Open the context menu and choose "Properties"
3. Select the register "HTTP-Header"
4. Click on the button labeled "MIME Types..."
5. If .xaml is not yet listed as a type, choose "New"
6. Enter the following description:
Extension: .xaml
MIME type: application/xaml+xml
7. Click "Ok",
8. Got to 5 and add xap and xbap as above then goto 9![]()
9. Choose "Apply" and you're set!
As a bonus if your an Iphone user you can also add this to your Mime types so that your Iphone can get updates from an IIS6 web site:
iPhone config file:
extension:.mobileconfig
MIME type: application/x-apple-aspen-config



