public string Execute() { switch (Packet.Command) { case EnvironmentServiceCommands.Restart: Trace.TraceInformation("srecmd: Restarting the service"); Environment.Exit(1); //the OS will recover it, need to set 'Restart After Failure' in Recovery Tab break; case EnvironmentServiceCommands.Stop: Trace.TraceInformation("srecmd: Starting the service(s)"); WindowsUtility.ExecuteBatchFile(EnvironmentFiles.StartFileName, true); break; case EnvironmentServiceCommands.StopSqlPuller: Trace.TraceInformation("srecmd: Stopping sql puller datasource id = " + Packet.Params["DataSourceId"]); new Idpe().StopSqlPuller(int.Parse(Packet.Params["DataSourceId"])); return(Constants.success); break; case EnvironmentServiceCommands.StartSqlPuller: Trace.TraceInformation("srecmd: Starting sql puller datasource id = " + Packet.Params["DataSourceId"]); new Idpe().StartSqlPuller(int.Parse(Packet.Params["DataSourceId"])); return(Constants.success); break; case EnvironmentServiceCommands.ExecuteDOSCommand: ExecuteCommand(Packet.Params["Command"]); break; case EnvironmentServiceCommands.DeployArtifacts: Trace.TraceInformation("srecmd: Deplying dlls"); new DeploymentService().DeployArtifacts(Packet.FileTransferPacket); break; default: throw new InvalidOperationException(string.Format("srecmd: Command executor does not recognize '{0}' command", Packet.Command.ToString())); } return(Constants.failed); }