Running the agent as a windows service


You can run the RapidDeploy agent as a Windows service using the procedure detailed below.

Environment Variables to set

These variables are optional and do not normally require setting unless you plan to install the agent separate to the Windows service files:

MV_AGENT_HOME: The agent home directory, containing agent files. This is the folder under which there are bin, lib, win-service directories
MV_AGENT_BASE: The agent base directory, containing MidVision windows service bat and exe files (mvagent.exe)
CMD_LINE_ARGS: The agent command line arguments, e.g. "definition=c:\Temp\agent\midvision-remoting-server.xml;name=midvision-remoting-server"
CLASSPATH: Classpath, including the agent orchestration jar file
MV_AGENT_DEFINITION_FILE: The agent definition xml file, normally "midvision-remoting-server.xml"
MV_AGENT_CLASS: The main class that starts the agent java process.
EXECUTABLE: The agent executable, e.g. "c:\Temp\agent\mvagent.exe"
JRE_HOME (or JAVA_HOME if jdk is installed) The path to the JDK or JRE on the agent server. By default the shipped one is used.
JVM: The Java VM dll, e.g. "C:\apps\Java\jdk1.6.0_23/jre\bin\server\jvm.dll"

Install service

  • Go to your $MV_AGENT_HOME/win-service directory.
  • Copy the files mv_agent_service.bat and mvagent.exe from this directory into $MV_AGENT_HOME, i.e. up one level.
  • Go to your $MV_AGENT_HOME/bin directory.
  • Copy midvision-remoting-agent-server.xml from this directory to $MV_AGENT_HOME folder i.e. up one level.
  • Go to the $MV_AGENT_HOME and rename midvision-remoting-agent-server.xml to midvision-remoting-server.xml.
  • Run, from the $MV_AGENT_HOME folder (to install):
    mv_agent_service.bat install

Remove service

Run (to remove service):

mv_agent_service.bat remove

Start/Stop agent service


net start "MidVisionAgent"


net stop "MidVisionAgent"

The stop may time out (but the service will be stopped).

Windows 32 and 64 bit platforms

There are two versions of mvagent.exe shipped in the agent. These are:

  • mvagent.exe (64 bit)
  • mvagent32.exe (32 bit)

If you are running on a 32 bit windows platform, with a 32 bit JRE, you must use the mvagent32.exe. In order to use this file, back up the mvagent.exe file and then rename mvagent32.exe to mvagent.exe. In all other cases, please use the shipped mvagent.exe.

You can check the version of JRE you are using as follows:

c:\>java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)


The above indicates a 64-Bit JRE.

Agent updates

If you update the agent, for example to add additional plugin jars to the lib directory, you will need to uninstall and then reinstall the windows service:

mv_agent_service.bat remove
mv_agent_service.bat install