RedPrairie/JDA WMS — Install/ Uninstall Service and generating env.bat
As an Application Administrator, it is part of your job description to create new test instances. Sometimes a clean instance won’t work and you’ll have to replicate your production to create an integrated test environment or unit test environment for example. However, there are certain steps you need to take after fixing the MOCA Registry with new environment variables and manually fixing env.bat with new parameters. Also to add, there are changes where if you forget to fix a parameter could cause transactions to flow from IT or UT instance to Production.
To install a service, you can use the following command:
servicemgr - e instancename install

Similarly to Uninstall:
servicemgr - e instancename uninstall

To generate a new env.bat file:
servicemgr - e instancename dump

Please do note that you should create env.bat in its default location, which is LESDIR\data to avoid confusion for others or them to accidentally run the wrong batch file to set old/invalid environment variables. Also, delete any older copies so it is not run by accident.
If the environment name (MOCA_ENVNAME) does not exist or the MOCA Registry does not exist in the rptab file — it will generate the following error:

For more information on the rptab file, Click Here to read about my blog on the rptab file.
If for some reason you’re unable to successfully install a service — let’s say having a bad env.bat or any other issues currently unknown to you. You can also use the following windows server command to manually create a service, though this is not recommended for production systems and you should investigate why install service is failing. However, for a lower environment running on RP 2011+, this will do just fine as MOCA Registry information is in a file rather than stored in Windows Registry.
sc create moca.ut_wm_new binPath="E:\JDA\ut_wm\MOCA\bin\prunsrv.exe //RS//moca.ut_wm" type=own start= auto error= normal depend= Tcpip/Afd tag= 0 DisplayName= "MOCA Server (ut_wm_new)"

Need any help? Please feel free to reach out if you have any questions. Cheers!