private void PrepareSummary(RemoteActionInfo remoteaction) { StringBuilder summary = new StringBuilder(); try { summary.AppendLine("Summary:"); summary.AppendLine("======"); summary.AppendLine("Action:" + remoteaction.RemoteActionCaption); summary.AppendLine("Servers:"); summary.AppendLine("======"); foreach (MachineInfo item in remoteaction.Machines) { summary.AppendLine(item.DomainName + @"\" + item.ServerName); } if (!String.IsNullOrWhiteSpace(remoteaction.RemoteShareLocation)) { summary.AppendLine("Share Path:" + remoteaction.RemoteShareLocation); } rtbSummary.Text = summary.ToString(); } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } }
public static Boolean RemoveRemoteAction(String ActionName) { Boolean result = false; List <RemoteActionInfo> remoteActionList = new List <RemoteActionInfo>(); try { remoteActionList = LoadRemoteActions(); RemoteActionInfo remoteAction = remoteActionList.Where(t => t.ActionName == ActionName).FirstOrDefault(); if (remoteAction != null) { remoteActionList.Remove(remoteAction); if (File.Exists(ApplicationInfo.RemoteActionFile)) { XMLSerializer <List <RemoteActionInfo> > .SerializeInputs(ApplicationInfo.RemoteActionFile, remoteActionList); } } result = true; } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } return(result); }
private void btnRun_Click(object sender, EventArgs e) { if (lvRemoteSettings.SelectedItems.Count > 0) { RemoteActionInfo remoteaction = Utility.GetRemoteAction(lvRemoteSettings.SelectedItems[0].Text); new StatusWindow(remoteaction).ShowDialog(this); } else { MessageBox.Show("Select a action.", ApplicationConstants.ApplicationName); } }
private void StartRemoteAction(RemoteActionInfo remoteActionInfo) { try { WMIMachineInfo machineInfo = new WMIMachineInfo(); machineInfo.ServersList = remoteActionInfo.Machines; machineInfo.CommandMode = EnumHelper.Mode.Action; machineInfo.backgroundWorker = progressDialog.worker; machineInfo.MachineConnectionInfo = new WMIConnectionInfo() { ReportMode = EnumHelper.OperationMode.Interactive, DatabaseConnectionInfo = Utility.LoadDbConnectionInfo(), }; if (remoteActionInfo.RemoteAction == EnumHelper.RemoteAction.RemoteInstall) { machineInfo.MachineConnectionInfo.ReportCategory = EnumHelper.WMIReportCategory.Application; machineInfo.ActionName = "Install"; } else if (remoteActionInfo.RemoteAction == EnumHelper.RemoteAction.RemoteReboot) { machineInfo.MachineConnectionInfo.ReportCategory = EnumHelper.WMIReportCategory.OperatingSystem; machineInfo.ActionName = "Reboot"; } else if (remoteActionInfo.RemoteAction == EnumHelper.RemoteAction.RemoteShutDown) { machineInfo.MachineConnectionInfo.ReportCategory = EnumHelper.WMIReportCategory.OperatingSystem; machineInfo.ActionName = "Shutdown"; } machineInfo.RemoteActionInfo = remoteActionInfo; ReportObject = new AMT.Manager.ReportManagers.InitializeWMICollection(); Boolean result = ReportObject.CollectReport(machineInfo); } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } }
public static RemoteActionInfo GetRemoteAction(String ActionName) { RemoteActionInfo remoteAction = null; List <RemoteActionInfo> remoteActionList = new List <RemoteActionInfo>(); try { remoteActionList = LoadRemoteActions(); remoteAction = remoteActionList.Where(t => t.ActionName == ActionName).FirstOrDefault(); } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } return(remoteAction); }
void Report_DoWork(ProgressDialog sender, DoWorkEventArgs e) { try { RemoteActionInfo remoteAction = (RemoteActionInfo)e.Argument; remoteAction.Machines = RemoteMachineCredentials(remoteAction); StartRemoteAction(remoteAction); } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } }
private void remoteActionWizardToolStripMenuItem_Click(object sender, EventArgs e) { RemoteShutdownWizard remoteShutdownWizard = new RemoteShutdownWizard(); if (remoteShutdownWizard.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { var t = new RemoteActionInfo() { RemoteAction = EnumHelper.RemoteAction.RemoteReboot, Machines = new List <MachineInfo>() { new MachineInfo() { DomainName = "Workgroup", ServerName = "10.70.70.48", UserName = "******", Password = "******" } }, ActionName = "Reboot" }; StatusWindow statusWindow = new StatusWindow(remoteShutdownWizard.remoteactionInfo); //StatusWindow statusWindow = new StatusWindow(t); statusWindow.ShowDialog(this); } }
private List <MachineInfo> RemoteMachineCredentials(RemoteActionInfo remoteAction) { List <MachineInfo> machinesWithConnectionDetails = new List <MachineInfo>(); try { foreach (MachineInfo machineItems in remoteAction.Machines) { if (!ConnectionManagerUtil.IsProfileConnected(machineItems.DomainName, machineItems.ServerName)) { ConnectionManager connectionManger = new ConnectionManager(machineItems.DomainName, machineItems.ServerName); if (connectionManger.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { machinesWithConnectionDetails.Add(ConnectionManagerUtil.GetConnectionDetails(machineItems.DomainName, machineItems.ServerName)); // StartReportCollection(machine.DomainName, machine.ServerName); } else { AMTLogger.WriteToLog("Connection cancelled for " + machineItems.DomainName + "/" + machineItems.ServerName); } } else { machinesWithConnectionDetails.Add(ConnectionManagerUtil.GetConnectionDetails(machineItems.DomainName, machineItems.ServerName)); } } } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } return(machinesWithConnectionDetails); }
public void ShowProgressDialog(RemoteActionInfo remoteActionInfo) { progressDialog = new ProgressDialog(); progressDialog.Argument = remoteActionInfo; progressDialog.DoWork += Report_DoWork; progressDialog.worker.RunWorkerCompleted += ReportWorker_RunWorkerCompleted; progressDialog.worker.ProgressChanged += worker_ProgressChanged; progressDialog.TopMost = false; // progressDialog.Parent = this; progressDialog.ProgressBar.Visible = true; progressDialog.ProgressBar.Style = ProgressBarStyle.Marquee; progressDialog.SetCaption("Remote Action"); progressDialog.Show(this); }
public LocationSelection(RemoteActionInfo remoteActionInfo) { InitializeComponent(); this.remoteActionInfo = remoteActionInfo; }
public MachineSelection(RemoteActionInfo remoteActionInfo) { InitializeComponent(); this.remoteActionInfo = remoteActionInfo; }
public Summary(RemoteActionInfo remoteActionInfo) { InitializeComponent(); this.remoteActionInfo = remoteActionInfo; }
public StatusWindow(RemoteActionInfo remoteactionInfo) { InitializeComponent(); this.remoteactionInfo = remoteactionInfo; }