+ Start a Discussion

Setting up Email to Case (email2case.bat) as a Windows System Service with Windows 2003 Server

Dear SalesForce Community,

as I just set up Email to Case as a Windows 2003 Server system service for the company I am working for, I would like to tell you how I did it. The instructions in this Discussion Boards are not as clear and rather misleading.

I assume Email to Case is already working by simply running the batch file.

1. Get the Windows Server 2003 Resource Kit Tools from:
2. Install them and type in the following on the command line:
    C:\Program Files\Windows Resource Kits\Tools\instsrv.exe" YourServiceName "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
    (This assumes you installed the tools to "C:\Program Files\Windows Resource Kits\Tools\". If you specified another path, use this one instead.
    Also you should replace "YourServiceName" by something like "SalesForceEmailAgent" as I named it.)
3. Open up the registry editor by running "regedit.exe"
4. Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName\
5. Create a new key below "YourServiceName" and name it "Parameters" (just like "Security" is a key below "YourServiceName")
6. Create a new String Value (REG_SZ) called "Application" and set the value to "C:\EmailAgent\email2case.bat" (or where ever your email2case.bat can be found)
7. Edit your email2case.bat and change it to:
    echo Email To Case Agent v1.07
    java -jar -Xmx256M C:\EmailAgent\Email2Case.jar C:\EmailAgent\sfdcConfig.txt C:\EmailAgent\log4j.properties

    (update the path to where you put your files)

8. Go to Control Panel -> Administrative Tools -> Services (or run "services.msc") and search for your entry ("YourServiceName")
9. Hit properties and make sure that its "Startup Type" is set to "Automatic"
10. Go to the "Log On" tab and make sure "Log on as:" is set to "Local System Account"
11. If you would start the service right now, it would run, but not write a log file. In order to get logging working, you need to edit your log4j.properties
    (can be found in the EmailAgent folder) and change the following two values:



    (or where ever your folder is located)

12. Just start the service and everything should work fine!

I hope this could solve the mystery of Windows Server 2003 services for the most of you. Feel free to comment on my solution.

Message Edited by fmr on 07-21-2008 08:27 AM
We installed the Email2Case agent on our Exchange Server.  To run the agent as a service, does your instructions  apply to the Exchange Server too?  We do not have anyone with Java experience so installing the Java Service Wrapper was not an option for us.  I tried installing ActivePlus ServiceMill software but I still could not get the agent to work, in fact it quick workin all together.  If I was to uninstall the ActivePlus software and follow your instructions would it work on the Exchange Server?
Any help you can offer will be great.
is there anything different for XP

This should work on Windows XP as well, since the ressource kit is also available for XP:


Message Edited by fmr on 11-07-2008 01:48 AM