Пример #1
0
        static public void KillCurrentProcess()
        {
            string currentHost = "";

            if (deployNameList.Count > 0)
            {
                currentHost = deployNameList[currentHostIndex];
            }

            Process[] psexec = Process.GetProcessesByName("PsExec");

            if (psexec.Count() > 0)
            {
                try
                {
                    psexec[0].Kill();
                    psexec[0].Dispose();
                    AppConsole.WriteLine("Process was manually aborted by user.");

                    if (currentHost != "")
                    {
                        MainFormAccess.mainForm.PConsoleAccess().AddLogEntry(currentHost, "Process manually aborted by user.");
                    }
                }
                catch
                {
                    AppConsole.WriteLine("Process could not be aborted.");
                }
            }

            else
            {
                AppConsole.WriteLine("No process running.");
            }
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            update = false;
            CheckForUpdate();

            if (update)
            {
                Process.Start(Directory.GetCurrentDirectory() + "\\edupdater.exe");
                Close();
                return;
            }

            screen = new Splash(this);
            screen.ShowDialog();

            StartRef = startDeploy;
            MainFormAccess.Init(this);

            LocalNetworkSettings.CheckForLocalDNSServers();
            AppConsole.Init(consoleDisplay, this);
            commandList   = new List <String>();
            username.Text = Environment.UserDomainName + "\\" + Environment.UserName;
            username.Select(username.Text.Length, 0);
            listMaker.initUseList(selectedComputers);
            deployTo.SelectedIndex = 2;
            priority.SelectedIndex = 2;
            //loadEasyFile();
        }
Пример #3
0
        static private void ProcessThreadFunction()
        {
            for (int i = 0; i < processList.Count; i++)
            {
                outputList.Add("");
                currentHostIndex = i;

                using (Process p = Process.Start(processList[i]))
                {
                    instances.Add(p);
                    AppConsole.WriteLine("Executing: PsExec.exe " + processList[i].Arguments);
                    incrementString  = "Deploying to: " + deployNameList[i];
                    incrementString2 = "Next: " + ((i + 1) < deployNameList.Count ? deployNameList[i + 1] : "");
                    SetDeployingToString();
                    StreamReader reader = new StreamReader(p.StandardError.BaseStream);
                    outputList[i] = reader.ReadToEnd().Replace("\r\n", "\n");
                    reader.Close();
                    reader         = new StreamReader(p.StandardOutput.BaseStream);
                    outputList[i] += reader.ReadToEnd().Replace("\r\n", "\n");
                    reader.Close();
                    MainFormAccess.mainForm.PConsoleAccess().AddProcessToList(deployNameList[i]);
                    IncrementBar();

                    // CODE TO ADD LOG ITEMS
                    MainFormAccess.mainForm.PConsoleAccess().AddLogEntry(deployNameList[i], outputList[i]);
                }
            }

            EndProcessWindow();
        }
Пример #4
0
        private void stopPsExecexeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process[] psexec = Process.GetProcessesByName("PsExec");
            if (psexec.Count() > 0)
            {
                psexec[0].Kill();
                AppConsole.WriteLine("PsExec.exe was manually aborted by User.");
            }

            else
            {
                AppConsole.WriteLine("PsExec.exe is not running.");
            }
        }
Пример #5
0
        static public void StartProcessing()
        {
            MainFormAccess.mainForm.DisableStart();
            processing = true;

            if (MainFormAccess.mainForm.PConsoleAccess().MSIDeployment)
            {
                MainFormAccess.mainForm.PConsoleAccess().msiLogPollingTimer.Enabled = true;
                MainFormAccess.mainForm.PConsoleAccess().AddLogEntry("Deployment", "MSI logging has been initiated.");
            }

            instances.Clear();
            AppConsole.WriteLine("Deployment Processing Started.");
            StartProcessWindow();
            mainThread = new Thread(new ThreadStart(ProcessThreadFunction));
            mainThread.Start();
        }
Пример #6
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (enteredPath.Text.Length >= 3)
            {
                if (enteredPath.Text[enteredPath.Text.Length - 1] == '\\')
                {
                    enteredPath.Text = enteredPath.Text.Remove(enteredPath.Text.Length - 1, 1);
                }

                parent.workPath = enteredPath.Text;
                AppConsole.WriteLine("Working Directory Set: " + enteredPath.Text);
                Close();
            }

            else
            {
                MessageBox.Show("Working path cannot be empty! Please enter a working directory path.", "Enter Working Path", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Пример #7
0
        static void EndProcessWindow()
        {
            Form1.prepareWindow.SetIncrementString("Done!", "Done!");
            AppConsole.WriteLine("Processing Completed.");
            MainFormAccess.mainForm.PConsoleAccess().AddLogEntry("Deployment", "Deployment finished.");

            processing = false;
            MainFormAccess.mainForm.EnableStart();
            MainFormAccess.mainForm.reEnableExitOps();

            if (!MainFormAccess.mainForm.IsProcessConsoleVisible())
            {
                ShowConsole();
            }

            if (MainFormAccess.mainForm.PConsoleAccess().MSIDeployment)
            {
                MessageBox.Show("Easy Deploy has finished starting all processes for this MSI Deployment. " +
                                "MSI Logging will stop once all packages have finished running.", "Easy Deploy - MSI Deployment", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #8
0
        static public void KillAll()
        {
            if (processing)
            {
                AppConsole.WriteLine("Stopping all processing.");
                Process[] psexec = Process.GetProcesses();
                processing = false;
                mainThread.Abort();
                Process p;

                if (instances.Count > 0)
                {
                    p = instances[instances.Count - 1];

                    try
                    {
                        if (p != null)
                        {
                            p.Kill();
                        }
                    }
                    catch (Exception e)
                    {
                        AppConsole.WriteLine("Process " + p.Id.ToString() + " could not be aborted. " + e.Message.ToString());
                    }
                }

                AppConsole.WriteLine("Deployment was manually aborted by user.");
                MainFormAccess.mainForm.PConsoleAccess().AddLogEntry("Deployment", "Deployment was manually aborted by user.");
            }

            else
            {
                AppConsole.WriteLine("No deployment to stop.");
            }
        }
Пример #9
0
 private void clearConsoleToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AppConsole.Clear();
 }