Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            MessageBus msg = (MessageBus)this.Resources["APPMessageBus"];

            DependencyInjection.SimpleContainer.MapInstance <ImessageBus>(msg);
            AdminCredentialsAndRemoteSoftware = new Commands.AdminCredentialsAndRemoteSoftware();


            string[] args = e.Args;
            if (args.Count() > 0)
            {
                DoArgs(args);
            }
            base.OnStartup(e);



            MainWindow main = new MainWindow();



            try
            {
                main.ShowDialog();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "ApplicationMSG");
            }
        }
Exemplo n.º 2
0
        internal void RunRemoteSoftware(UserControls.RemoteSoftware sof, string ComputerName)
        {
            string Options = sof.Options;

            Options = Options.Replace("{computerName}", ComputerName);
            if (Options.Contains("{userName}"))
            {
                Options = Options.Replace("{userName}", Properties.Settings.Default.txt_AdminUser);
            }
            if (Options.Contains("{password}"))
            {
                Options = Options.Replace("{password}", Utility.AdminPassword);
            }

            Task.Run(() =>
            {
                StartProcess(sof.ProgramPath, Options);
            });

            AdminCredentialsAndRemoteSoftware acr = App.AdminCredentialsAndRemoteSoftware;

            acr.UserName = Properties.Settings.Default.txt_AdminUser;
            // acr.SecureStringPassword = Utility.AdminPassword.ToSecure();
            acr.Password     = Utility.AdminPassword;
            acr.Arguments    = Options;
            acr.FileName     = sof.ProgramPath;
            acr.Domain       = Properties.Settings.Default.txt_Domain;
            acr.ComputerName = ComputerName;
        }
Exemplo n.º 3
0
        internal void ComputerRDP(string ComputerName)
        {
            Process process = new Process();

            process.StartInfo.FileName        = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe");
            process.StartInfo.Arguments       = string.Format("/generic:TERMSRV/{0} /user:{1} /pass:{2}", ComputerName, Properties.Settings.Default.txt_AdminUser, Utility.AdminPassword);
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.CreateNoWindow  = true;
            process.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
            process.Start();

            process.StartInfo.FileName        = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
            process.StartInfo.Arguments       = string.Format("/admin /v:{0}", ComputerName); // ip or name of computer to connect
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.CreateNoWindow  = true;

            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            process.Start();
            App.RunProcess = process;

            AdminCredentialsAndRemoteSoftware acr = App.AdminCredentialsAndRemoteSoftware;

            acr.UserName     = Properties.Settings.Default.txt_AdminUser;
            acr.Password     = Utility.AdminPassword;
            acr.FileName     = "mstsc";
            acr.Domain       = Properties.Settings.Default.txt_Domain;
            acr.ComputerName = ComputerName;
        }
Exemplo n.º 4
0
        public void RunRemoteSoftware(AdminCredentialsAndRemoteSoftware acr)
        {
            if (acr.FileName.ToLower().Contains("mstsc"))
            {
                Process process = new Process();
                process.StartInfo.FileName        = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe");
                process.StartInfo.Arguments       = string.Format("/generic:TERMSRV/{0} /user:{1} /pass:{2}", acr.ComputerName, acr.UserName, acr.Password);
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow  = true;
                process.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
                process.Start();

                process.StartInfo.FileName        = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
                process.StartInfo.Arguments       = string.Format("/admin /v:{0}", acr.ComputerName); // ip or name of computer to connect
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow  = true;

                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                process.Start();
            }
            else
            {
                ProcessStartInfo psi = new ProcessStartInfo();

                string pass = acr.Password;

                psi.FileName        = acr.FileName;
                psi.UserName        = acr.UserName;
                psi.Domain          = acr.Domain;
                psi.Password        = pass.ToSecure();
                psi.UseShellExecute = false;
                //psi.RedirectStandardOutput = true;
                //psi.RedirectStandardError = true;
                psi.Arguments = acr.Arguments;

                //string str = string.Format("psi.FileName {0} | psi.UserName {1} | psi.Password {2} psi.Arguments {3}", acr.FileName, acr.UserName, pass, acr.Arguments);
                //System.Windows.Forms.MessageBox.Show(str);

                Process.Start(psi);
                try
                {
                    Process.Start(psi);
                    //Clients.Caller.
                }
                catch (Exception ex)
                {
                    throw new NotImplementedException(ex.Message, ex);
                }
            }
        }