コード例 #1
0
ファイル: WMIBase.cs プロジェクト: Muruganalagesan/AMT
        public bool CollectData(WMIMachineInfo wmiMachineInfo)
        {
            Boolean result = false;

            try
            {
                this.MachineInfo = wmiMachineInfo;

                foreach (var item in wmiMachineInfo.ServersList)
                {
                    this.MachineDetails = item;

                    this.InputConnectionInfo = wmiMachineInfo.MachineConnectionInfo;



                    if (WMIConnect())
                    {
                        CollectReportData();

                        WMIDisConnect();
                    }
                }
                DBInitiate();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }
            return(result);
        }
コード例 #2
0
        private WMIMachineInfo InitParamCollection(List <MachineInfo> machineItems, Boolean IsRefresh = false)
        {
            //if (userCredential.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
            wmimachineInfo = new WMIMachineInfo()
            {
                ServersList = machineItems,


                MachineConnectionInfo = new WMIConnectionInfo()
                {
                    ReportCategory = this.ReportCategory,
                    ReportMode     = EnumHelper.OperationMode.Interactive,

                    TimeStamp = this.ReportCategory.ToString() + Utility.GetReportGuid(),
                    DatabaseConnectionInfo = Utility.LoadDbConnectionInfo()
                },
                IsRefersh = IsRefresh,
                // CommandMode= EnumHelper.Mode.Action
                CommandMode = EnumHelper.Mode.Collection
            };

            //  }



            return(wmimachineInfo);
        }
コード例 #3
0
ファイル: ReportWindow.cs プロジェクト: Muruganalagesan/AMT
        private WMIMachineInfo InitParamCollection(Boolean IsRefresh = false)
        {
            //objWMIConnectionInfo = new WMIConnectionInfo()
            //   {
            //       ReportCategory = this.ReportCategory,
            //       ReportMode = EnumHelper.OperationMode.Interactive,

            //       TimeStamp = this.ReportCategory.ToString() + Utility.GetReportGuid(),
            //       dbConnectionInfo = new DBConnectionInfo
            //       {
            //           AuthenticationType = EnumHelper.Authentication.SQLAuthentication,
            //           DatabaseName = "AMTTest3",
            //           DatabaseType = EnumHelper.Databases.SQLServer,
            //           ServerName = "192.168.0.35",
            //           UserName = "******",
            //           Password = "******"
            //       }

            //   }


            wmimachineInfo = new WMIMachineInfo()
            {
                ServersList = new List <MachineInfo>()
                {
                    //Orginal code
                    new MachineInfo {
                        DomainName = "workgroup", ServerName = "10.70.70.48", Password = "******", UserName = "******"
                    },

                    new MachineInfo {
                        ServerName = "192.168.1.47", UserName = "******", Password = "******", DomainName = "workgroup"
                    }
                },


                MachineConnectionInfo = new WMIConnectionInfo()
                {
                    ReportCategory = this.ReportCategory,
                    ReportMode     = EnumHelper.OperationMode.Interactive,

                    TimeStamp = this.ReportCategory.ToString() + Utility.GetReportGuid(),
                    DatabaseConnectionInfo = new DBConnectionInfo
                    {
                        //AuthenticationType = EnumHelper.Authentication.SQLAuthentication,
                        DatabaseName = "AMTTest",
                        DatabaseType = EnumHelper.Databases.SQLServerCE,

                        DBPath = AppDomain.CurrentDomain.BaseDirectory
                                 //  ServerName = "192.168.0.35",
                                 //   UserName = "******",
                                 //  Password = "******"
                    }
                },
                IsRefersh = IsRefresh
            };
            return(wmimachineInfo);
        }
コード例 #4
0
ファイル: ReportWindow.cs プロジェクト: Muruganalagesan/AMT
        private InitializeWMICollection DoAction()
        {
            WMIMachineInfo machineInfo = InitParamCollection(IsRefresh);

            machineInfo.CommandMode = EnumHelper.Mode.Action;


            ReportObject = new AMT.Manager.ReportManagers.InitializeWMICollection();

            Boolean result = ReportObject.CollectReport(machineInfo);

            return(ReportObject);
        }
コード例 #5
0
ファイル: WMIBase.cs プロジェクト: Muruganalagesan/AMT
        public DataTable GetReportDataTable(WMIMachineInfo wmiConnectionInfo)
        {
            DataTable result = new DataTable();

            try
            {
                result = GetReportData();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #6
0
ファイル: StatusWindow.cs プロジェクト: Muruganalagesan/AMT
        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);
            }
        }
コード例 #7
0
ファイル: WMIManagerBase.cs プロジェクト: Muruganalagesan/AMT
        public bool CollectWMIData(WMIMachineInfo wmiConnectionInfo)
        {
            Boolean result = false;

            try
            {
                this.wmiMachineInfo = wmiConnectionInfo;
                Collect();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #8
0
        public Boolean  CollectReport(WMIMachineInfo inputMachineInfo)
        {
            Boolean result = false;

            try
            {
                wmimachineInfo = inputMachineInfo;
                result         = ManagerInitializer(inputMachineInfo);
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #9
0
        public DataTable GetWMIReportData(WMIMachineInfo wmiMachineInfo)
        {
            DataTable result = null;


            try
            {
                result = wmiInit.GetReportDataTable(wmiMachineInfo);
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #10
0
        private InitializeWMICollection DoReportCollection(List <MachineInfo> machineItems, Boolean IsRefresh = false)
        {
            try
            {
                WMIMachineInfo machineInfo = InitParamCollection(machineItems, IsRefresh);

                machineInfo.backgroundWorker = progressDialog.worker;

                Boolean result = ReportObject.CollectReport(machineInfo);
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }


            return(ReportObject);
        }
コード例 #11
0
ファイル: WMIBase.cs プロジェクト: Muruganalagesan/AMT
        //  public String ActionName { get; set; }



        public Boolean DoWMIAction(WMIMachineInfo wmimachineInfo)
        {
            Boolean result = false;

            try
            {
                this.MachineInfo = wmimachineInfo;

                foreach (var item in wmimachineInfo.ServersList)
                {
                    this.MachineDetails = item;



                    this.InputConnectionInfo = wmimachineInfo.MachineConnectionInfo;

                    UpdateRemoteActionStatus("Initiating connection to " + item.ServerName);

                    if (WMIConnect())
                    {
                        UpdateRemoteActionStatus("Connected sucessfully to " + item.ServerName);

                        UpdateRemoteActionStatus("Initating remote action...");

                        DoAction();

                        WMIDisConnect();

                        UpdateRemoteActionStatus("Disconnected from " + item.ServerName);
                    }
                    else
                    {
                        UpdateRemoteActionStatus("Failed connecting to " + item.ServerName);
                    }
                }
                //DBInitiate();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #12
0
ファイル: ReportWindow.cs プロジェクト: Muruganalagesan/AMT
        private InitializeWMICollection DoReportCollection(Boolean IsRefresh = false)
        {
            try
            {
                WMIMachineInfo machineInfo = InitParamCollection(IsRefresh);


                ReportObject = new AMT.Manager.ReportManagers.InitializeWMICollection();

                Boolean result = ReportObject.CollectReport(machineInfo);
            }
            catch (Exception)
            {
                throw;
            }


            return(ReportObject);
        }
コード例 #13
0
        private InitializeWMICollection DoAction(List <MachineInfo> machineInfoItems, Boolean IsRefresh)
        {
            try
            {
                WMIMachineInfo machineInfo = InitParamCollection(machineInfoItems, IsRefresh);

                machineInfo.CommandMode = EnumHelper.Mode.Action;
                //machineInfo.OwnerHandle = this.Handle;

                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);
            }

            return(ReportObject);
        }
コード例 #14
0
        private bool ManagerInitializer(WMIMachineInfo inputMachineInfo)
        {
            Boolean result = false;



            try
            {
                InitManagers(inputMachineInfo.MachineConnectionInfo.ReportCategory);


                // if (inputMachineInfo.CommandMode == ReportingInterfaces.EnumHelper.Mode.Collection)
                wmicollect.CollectWMIData(inputMachineInfo);
                //else
                //    wmicollect.DoWMIAction(inputMachineInfo);
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
コード例 #15
0
ファイル: TaskInitiator.cs プロジェクト: Muruganalagesan/AMT
        private void GetTaskDetails(String taskName)
        {
            try
            {
                wmiMachineInfo = new WMIMachineInfo()
                {
                    ServersList = new List <MachineInfo>()
                    {
                        new MachineInfo()
                        {
                            DomainName = "Workgroup", ServerName = "WIN-SW2OU9PMIRD", UserName = "******", Password = "******"
                        },
                        new MachineInfo()
                        {
                            DomainName = "Workgroup", ServerName = "WIN-NLOJWL4JWAU", UserName = "******", Password = "******"
                        }
                    },


                    MachineConnectionInfo = new WMIConnectionInfo()
                    {
                        ReportCategory = this.ReportCategory,
                        ReportMode     = EnumHelper.OperationMode.Schedule,

                        TimeStamp = this.ReportCategory.ToString() + Utility.GetReportGuid(),
                        DatabaseConnectionInfo = Utility.LoadDbConnectionInfo()
                    },
                    IsRefersh = true,
                    // CommandMode= EnumHelper.Mode.Action
                    CommandMode = EnumHelper.Mode.Collection
                };
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #16
0
ファイル: AMTMain.cs プロジェクト: Muruganalagesan/AMT
        private static void RemoteMachineReebot()
        {
            // ReportWindow serviceReportWindow = new ReportWindow(ReportingInterfaces.EnumHelper.WMIReportCategory.OperatingSystem,EnumHelper.Mode.Action );
            InitializeWMICollection ReportObject = null;

            ReportObject = new AMT.Manager.ReportManagers.InitializeWMICollection();

            WMIMachineInfo wmimachineInfo = new WMIMachineInfo()
            {
                ServersList = new List <MachineInfo>()
                {
                    new MachineInfo()
                    {
                        DomainName = "Workgroup", ServerName = "10.70.70.48", UserName = "******", Password = "******"
                    }
                },


                MachineConnectionInfo = new WMIConnectionInfo()
                {
                    ReportCategory = ReportingInterfaces.EnumHelper.WMIReportCategory.OperatingSystem,
                    ReportMode     = EnumHelper.OperationMode.Interactive,

                    TimeStamp = ReportingInterfaces.EnumHelper.WMIReportCategory.OperatingSystem.ToString() + Utility.GetReportGuid(),
                    DatabaseConnectionInfo = Utility.LoadDbConnectionInfo()
                },
                IsRefersh = true,
                // CommandMode= EnumHelper.Mode.Action
                CommandMode = EnumHelper.Mode.Action,
                ActionName  = WMIConstants.MachineReboot
            };

            ReportObject.CollectReport(wmimachineInfo);
            //serviceReportWindow.MdiParent = this;
            //serviceReportWindow.Show();
        }
コード例 #17
0
        public Boolean InitWMIDataCollection(WMIMachineInfo wmiMachineInfo)
        {
            Boolean result = false;

            // IWMIInit wmiInit = null;
            try
            {
                if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.Services)
                {
                    wmiInit = new WMIServiceInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.Application)
                {
                    wmiInit = new WMIProductInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.QuickFix)
                {
                    wmiInit = new WMI.WMIQuickFixInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.LogicalDisk)
                {
                    wmiInit = new WMI.WMILogicalDiskInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.ComputerSystem)
                {
                    wmiInit = new WMI.WMICompSysInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.BIOS)
                {
                    wmiInit = new WMI.WMIBiosInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.BootConfiguration)
                {
                    wmiInit = new WMI.WMIBootInfo();
                }


                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.OperatingSystem)
                {
                    wmiInit = new WMI.WMIOSInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.EnvironmentVaraiable)
                {
                    wmiInit = new WMI.WMIEnvInfo();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.NetworkAdapter)
                {
                    wmiInit = new WMI.WMINetworkAdapter();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.NetworkLoginProfile)
                {
                    wmiInit = new WMI.WMINetworkLoginProfile();
                }


                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.Groups)
                {
                    wmiInit = new WMI.WMIGroups();
                }

                else if (wmiMachineInfo.MachineConnectionInfo.ReportCategory == EnumHelper.WMIReportCategory.Users)
                {
                    wmiInit = new WMI.WMIUsers();
                }

                if (wmiMachineInfo.CommandMode == EnumHelper.Mode.Collection)
                {
                    wmiInit.CollectData(wmiMachineInfo);
                }
                else
                {
                    ((WMIActionBase)(wmiInit)).DoWMIAction(wmiMachineInfo);

                    // wmiInit.InitAction(wmiMachineInfo);
                }
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }