Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 public LocationSelection(RemoteActionInfo remoteActionInfo)
 {
     InitializeComponent();
     this.remoteActionInfo = remoteActionInfo;
 }
Ejemplo n.º 11
0
 public MachineSelection(RemoteActionInfo remoteActionInfo)
 {
     InitializeComponent();
     this.remoteActionInfo = remoteActionInfo;
 }
Ejemplo n.º 12
0
 public Summary(RemoteActionInfo remoteActionInfo)
 {
     InitializeComponent();
     this.remoteActionInfo = remoteActionInfo;
 }
Ejemplo n.º 13
0
        public StatusWindow(RemoteActionInfo remoteactionInfo)
        {
            InitializeComponent();

            this.remoteactionInfo = remoteactionInfo;
        }