Esempio n. 1
0
        public bool Run(ManagementScope connection)
        {
            CommandTable table = new CommandTable();

            table.AddRow(table.AddRow("Name", "Value").MakeSeparator());

            ManagementObjectSearcher searcher = new ManagementObjectSearcher(connection, new ObjectQuery(Sql));

            foreach (ManagementObject q in searcher.Get())
            {
                foreach (PropertyData p in q.Properties)
                {
                    try
                    {
                        CommandTableRow row = table.AddRow(1, new string[] { p.Name, p.Value.ToString() });
                        row[0].ForeColor = ConsoleColor.DarkGray;
                        row[1].Align     = CommandTableCol.EAlign.None;
                    }
                    catch { }
                }

                table.AddSeparator(2, '-');
            }

            WriteTable(table);
            return(true);
        }