Example #1
0
        public static string GetFirewall()
        {
            try
            {
                string firewallName = string.Empty;
                // starting with Windows Vista we must use the root\SecurityCenter2 namespace
                string scope = (PlatformHelper.VistaOrHigher) ? "root\\SecurityCenter2" : "root\\SecurityCenter";
                string query = "SELECT * FROM FirewallProduct";

                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
                {
                    foreach (ManagementObject mObject in searcher.Get())
                    {
                        firewallName += mObject["displayName"].ToString() + "; ";
                    }
                }
                firewallName = FormatHelper.RemoveEnd(firewallName);

                return((!string.IsNullOrEmpty(firewallName)) ? firewallName : "N/A");
            }
            catch
            {
                return("Unknown");
            }
        }
Example #2
0
        public static string GetGpuName()
        {
            try
            {
                string gpuName = string.Empty;
                string query   = "SELECT * FROM Win32_DisplayConfiguration";

                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
                {
                    foreach (ManagementObject mObject in searcher.Get())
                    {
                        gpuName += mObject["Description"].ToString() + "; ";
                    }
                }
                gpuName = FormatHelper.RemoveEnd(gpuName);

                return((!string.IsNullOrEmpty(gpuName)) ? gpuName : "N/A");
            }
            catch
            {
                return("Unknown");
            }
        }
Example #3
0
        public static string GetCpuName()
        {
            try
            {
                string cpuName = string.Empty;
                string query   = "SELECT * FROM Win32_Processor";

                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
                {
                    foreach (ManagementObject mObject in searcher.Get())
                    {
                        cpuName += mObject["Name"].ToString() + "; ";
                    }
                }
                cpuName = FormatHelper.RemoveEnd(cpuName);

                return((!string.IsNullOrEmpty(cpuName)) ? cpuName : "N/A");
            }
            catch
            {
            }

            return("Unknown");
        }