public IResult SendMessage(MessageExecutor Msg, string TargetSystemName) { RemoteExecutionManager RemoteExec = new RemoteExecutionManager(); RemoteExec.Command = Msg; NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = TargetSystemName; RemoteExec.NetParams = NetParams; IResult ExecutionResult = RemoteExec.Execute(); return(ExecutionResult); }
private IResult RemoteExecute(ExecuteBatchFile BatchExecuteEntity) { RemoteExecutionManager RemoteExecutor = new RemoteExecutionManager(); RemoteExecutor.Command = BatchExecuteEntity; NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = RemoteMachine; RemoteExecutor.NetParams = NetParams; IResult Result = RemoteExecutor.Execute(); return(Result); }
private void ServiceContextActionButton_Click(object sender, EventArgs e) { ServiceParameters ServiceParams = new ServiceParameters(); ServiceParams.ServiceName = SelectedService; NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = MachineName; RemoteExecutionManager RemoteExec = new RemoteExecutionManager(); if (ServiceAction == ServiceActionType.StartService) { StartService Start = new StartService(); Start.ServiceParameters = ServiceParams; RemoteExec.Command = Start; RemoteExec.NetParams = NetParams; IResult StartResult = RemoteExec.Execute(); if (StartResult.Result == ExecutionResultType.Passed) { MessageBox.Show(SelectedService + " has been successfully started on the remote machine " + MachineName, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshServiceList(); } else { MessageBox.Show("Failed to start the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StartResult.FailureException.Message, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (ServiceAction == ServiceActionType.StopService) { StopService Stop = new StopService(); Stop.ServiceParameters = ServiceParams; RemoteExec.Command = Stop; RemoteExec.NetParams = NetParams; IResult StopResult = RemoteExec.Execute(); if (StopResult.Result == ExecutionResultType.Passed) { MessageBox.Show(SelectedService + " has been successfully stopped on the remote machine " + MachineName, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshServiceList(); } else { MessageBox.Show("Failed to stop the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StopResult.FailureException.Message, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private IResult StartProgram(string ProgramPath) { StartProcess ProcStart = new StartProcess(); ProcessParameters ProcParam = new ProcessParameters(); NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = RemoteMachineName; ProcParam.ProcessName = ProgramPath; ProcStart.ProcessParameters = ProcParam; RemoteExecutionManager RemoteExec = new RemoteExecutionManager(); RemoteExec.Command = ProcStart; RemoteExec.NetParams = NetParams; IResult ExecResult = RemoteExec.Execute(); return(ExecResult); }
private IResult ExecuteStopCommand() { IResult ExecuteResult = new ExecutionResult(); if (SelectedProcess.Length > 0) { StopProcess CmdStopProc = new StopProcess(); ProcessParameters ProcParam = new ProcessParameters(); NetworkParameters NetParam = new NetworkParameters(); NetParam.RemoteSystemName = MachineName; ProcParam.ProcessName = SelectedProcess; CmdStopProc.ProcessParameters = ProcParam; RemoteExecutionManager ProcessStop = new RemoteExecutionManager(); ProcessStop.Command = CmdStopProc; ProcessStop.NetParams = NetParam; ExecuteResult = ProcessStop.Execute(); } return(ExecuteResult); }
public void RetrieveAllProcesses() { RemoteExecutionManager RemoteProcessList = new RemoteExecutionManager(); NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = MachineName; ListAllProcesses AllProcList = new ListAllProcesses(); RemoteProcessList.Command = AllProcList; RemoteProcessList.NetParams = NetParams; IResult RemoteExecResult = RemoteProcessList.Execute(); if (RemoteExecResult.Result == ExecutionResultType.Passed) { PopulateProcessListView(RemoteExecResult as ExecutionResult); } else { MessageBox.Show("Retrieving remote process list, from machine " + MachineName + ", failed due to the following reason : " + RemoteExecResult.FailureException.Message, "Desk Connect - Process Retrieval Operation", MessageBoxButtons.OK, MessageBoxIcon.Error); } }