• How to get computer properties using WMI in C#

    Posted on October 24, 2012 by in Dotnet Tips & Tricks, Tips & Tricks

    public static void RetrieveComputerProps()
        //initialize the select query with command text
        SelectQuery query = new SelectQuery(@"Select * from Win32_ComputerSystem");
        //initialize the searcher with the query it is supposed to execute
        using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
            //execute the query
            foreach (ManagementObject process in searcher.Get())
                //print system info
                Console.WriteLine("/*********Operating System Information ***************/");
                Console.WriteLine("{0}{1}", "Caption :", process["Caption"]);
                Console.WriteLine("{0}{1}", "Description:", process["Description"]);
                Console.WriteLine("{0}{1}", "Manufacturer:", process["Manufacturer"]);
                Console.WriteLine("{0}{1}", "Model:", process["Model"]);
                Console.WriteLine("{0}{1}", "TotalPhysicalMemory:", process["TotalPhysicalMemory"]);

    get computer properties using WMI

    List of Properties:

    Data Type Property Name
    uint16 AdminPasswordStatus
    boolean AutomaticManagedPagefile
    boolean AutomaticResetBootOption
    boolean AutomaticResetCapability
    uint16 BootOptionOnLimit
    uint16 BootOptionOnWatchDog
    boolean BootROMSupported
    string BootupState
    string Caption
    uint16 ChassisBootupState
    string CreationClassName
    sint16 CurrentTimeZone
    boolean DaylightInEffect
    string Description
    string DNSHostName
    string Domain
    uint16 DomainRole
    boolean EnableDaylightSavingsTime
    uint16 FrontPanelResetStatus
    boolean InfraredSupported
    string InitialLoadInfo
    datetime InstallDate
    uint16 KeyboardPasswordStatus
    string LastLoadInfo
    string Manufacturer
    string Model
    string Name
    string NameFormat
    boolean NetworkServerModeEnabled
    uint32 NumberOfLogicalProcessors
    uint32 NumberOfProcessors
    uint8 OEMLogoBitmap[]
    string OEMStringArray[]
    boolean PartOfDomain
    sint64 PauseAfterReset
    uint16 PCSystemType
    uint16 PowerManagementCapabilities[]
    boolean PowerManagementSupported
    uint16 PowerOnPasswordStatus
    uint16 PowerState
    uint16 PowerSupplyState
    string PrimaryOwnerContact
    string PrimaryOwnerName
    uint16 ResetCapability
    sint16 ResetCount
    sint16 ResetLimit
    string Roles[]
    string Status
    string SupportContactDescription[]
    uint16 SystemStartupDelay
    string SystemStartupOptions[]
    uint8 SystemStartupSetting
    string SystemType
    uint16 ThermalState
    uint64 TotalPhysicalMemory
    string UserName
    uint16 WakeUpType
    string Workgroup
    string SupportContactDescription[]
    Be Sociable, Share!
      Post Tagged with , ,

    Written by

    Software architect with over 10 years of proven experience in designing & developing n-tier and web based software applications, for Finance, Telecommunication, Manufacturing, Internet and other Commercial industries. He believes that success depends on one's ability to integrate multiple technologies to solve a simple as well as complicated problem.

    View all articles by

    Email : [email protected]

    Leave a Reply