Example #1
0
        private void Act_StartCheckReboot(DataGridViewRow row)
        {
            try
            {
                DgvUtils.SetRowValue(ref row, WUCollums.RebootRequired, false);
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, string.Empty);

                OperSystemUtils operUtils = new OperSystemUtils();

                string host           = row.Cells["Host"].Value.ToString();
                bool   isRequiredBoot = operUtils.IsRebootRequired(host);

                if (isRequiredBoot)
                {
                    DgvUtils.SetRowValue(ref row, WUCollums.RebootRequired, true);
                    DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, "Reboot Required");
                }
                else
                {
                    DgvUtils.SetRowValue(ref row, WUCollums.RebootRequired, false);
                    DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, "Reboot NOT Required");
                }
            }
            catch (Exception erro)
            {
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, erro.Message);
            }
        }
Example #2
0
        private void Act_ResetAuthorizationOnWsus(DataGridViewRow row)
        {
            try
            {
                DgvUtils.SetRowValue(ref row, WUCollums.Status, "Starting");
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, "Executing reset authorization (wuauclt.exe /resetauthorization /detectnow)");

                OperSystemUtils operUtils = new OperSystemUtils(ConfigurationFileHelper.RemoteOperationsUsesDCOM);

                string host            = row.Cells["Host"].Value.ToString();
                bool   operationResult = operUtils.ResetAuthorizationOnWsus(host);

                if (operationResult)
                {
                    DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, "Reset authorization executed successfully");
                }
                else
                {
                    DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, "Reset authorization NOT executed");
                }

                DgvUtils.SetRowValue(ref row, WUCollums.Status, "Finish");
            }
            catch (Exception erro)
            {
                DgvUtils.SetRowValue(ref row, WUCollums.Status, "ThreadError");
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, erro.Message);
            }
        }
Example #3
0
        static void TestIsRebootRequired(string serverName)
        {
            try
            {
                Console.WriteLine("");
                Console.WriteLine("=== Reboot Requerido -> Iniciando  ===");
                Console.WriteLine("");

                OperSystemUtils operUtils = new OperSystemUtils(ConfigurationFileHelper.RemoteOperationsUsesDCOM);

                Console.WriteLine("RemoteOperationsUsesDCOM: {0}", ConfigurationFileHelper.RemoteOperationsUsesDCOM);
                Console.WriteLine("Registry Path: {0}", operUtils.GetRebootRequiredRegistryPath());

                Console.WriteLine("IsRebootRequired: {0}", operUtils.IsRebootRequired(serverName));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Erro: {0}", ex.Message);
            }
            finally
            {
                Console.WriteLine("");
                Console.WriteLine("=== Reboot Requerido -> Concluido ===");
            }
        }
Example #4
0
        private void Act_CountUpdatesExecutor(object rowObject)
        {
            DataGridViewRow row = (DataGridViewRow)rowObject;

            try
            {
                OperSystemUtils operSys = new OperSystemUtils();

                row.DefaultCellStyle.BackColor          = Color.FromArgb(255, 255, 160);
                row.DefaultCellStyle.SelectionBackColor = Color.Coral;

                DgvUtils.SetRowValue(ref row, WUCollums.Status, "Starting");
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, string.Empty);
                DgvUtils.SetRowValue(ref row, WUCollums.Progress, 0);

                string hostName = row.Cells["Host"].Value.ToString();

                try
                {
                    operSys.CopyPsExec(hostName);
                }
                catch (Exception ex)
                {
                    DgvUtils.SetRowValue(ref row, WUCollums.Status, "StartError");
                    DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, ex.Message);
                    this.Sys_RemoveThreadRow(ref row);
                    return;
                }

                StreamReader reader = operSys.ExecWua("/countUpdates", hostName);

                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    Act_InstallUpdatesInterpretor(ref row, line);
                }
            }
            catch (Exception ex)
            {
                DgvUtils.SetRowValue(ref row, WUCollums.Status, "ThreadError");
                DgvUtils.SetRowValue(ref row, WUCollums.OperationResults, ex.Message);
            }
            finally
            {
                this.Sys_RemoveThreadRow(ref row);
            }
        }