コード例 #1
0
ファイル: IDF.cs プロジェクト: benfogel/WebAdministration
        protected override void Run()
        {
            Process proc = new Process();

            proc.StartInfo.UserName = AdminAccounts.GetAdminAccount1().UserName;
            SecureString secure = AdminAccounts.GetAdminAccount1().SecurePassword;

            proc.StartInfo.Domain                 = Domain.GetDomain();
            proc.StartInfo.Password               = secure;
            proc.StartInfo                        = new ProcessStartInfo(@"cmd.exe", String.Format(@"/c installIDF.cmd {0}", _comp.IPAddress));
            proc.StartInfo.WorkingDirectory       = @"C:\Manage\IdentityFinder";
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError  = true;
            //proc.EnableRaisingEvents = true;
            proc.OutputDataReceived += (sender, args) => UpdateStatus(args.Data);
            proc.ErrorDataReceived  += (sender, args) => UpdateStatus(args.Data);

            noErrorCount = 0;

            proc.Start();
            proc.BeginOutputReadLine();
            proc.BeginErrorReadLine();
            proc.WaitForExit(60);
        }
コード例 #2
0
        protected override void Run()
        {
            Process proc = new Process();

            proc.StartInfo.UserName = AdminAccounts.GetAdminAccount1().UserName;
            proc.StartInfo.Password = AdminAccounts.GetAdminAccount1().SecurePassword;

            proc.StartInfo.Domain = Domain.GetDomain();
            if (_comp.USMTGID != "aulease")
            {
                proc.StartInfo = new ProcessStartInfo(@"cmd.exe", String.Format(@"/c schedUSMT.cmd {0} {1} {2}", _comp.IPAddress, _comp.USMTGID, _comp.NewIPAddress));
            }
            else
            {
                proc.StartInfo = new ProcessStartInfo(@"cmd.exe", String.Format(@"/c schedUSMTasAULease.cmd {0} {1}", _comp.IPAddress, _comp.NewIPAddress));
            }
            proc.StartInfo.WorkingDirectory       = @"C:\Manage\USMT";
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError  = true;
            proc.EnableRaisingEvents = true;
            proc.OutputDataReceived += (sender, args) => UpdateStatus(args.Data);
            proc.ErrorDataReceived  += (sender, args) => UpdateStatus(args.Data);

            noErrorCount = 0;

            proc.Start();
            proc.BeginOutputReadLine();
            proc.BeginErrorReadLine();
            proc.WaitForExit(60);
        }
コード例 #3
0
ファイル: IDF.cs プロジェクト: benfogel/WebAdministration
        public bool IsAppInstalled(string p_machineName)
        {
            ConnectionOptions op = new ConnectionOptions();

            op.Username = Domain.AddDomainToUsername(AdminAccounts.GetAdminAccount2().UserName);
            op.Password = AdminAccounts.GetAdminAccount2().Password;
            ManagementScope scope = new ManagementScope(String.Format(@"\\{0}\root\cimv2", p_machineName), op);

            scope.Connect();
            ManagementPath  path     = new ManagementPath("Win32_Product");
            ManagementClass programs = new ManagementClass(scope, path, null);

            foreach (ManagementObject program in programs.GetInstances())
            {
                object programName = program.GetPropertyValue("Name");

                if (programName != null && programName.ToString().Equals("Identity Finder", StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }