Gomathipriya
Gomathipriya

Reputation: 945

Version information not displaying

the following code doesnot shows the version information correctly.

     ManagementObjectSearcher mos = new ManagementObjectSearcher(new SelectQuery("Win32_Processor"));
        ManagementObjectCollection moc = mos.Get();
        foreach (ManagementObject mo in moc)
        {
Console.WriteLine("Version: " +mo["Version"].ToString());
}

it displays blank screen.

am using windows 7 version...

how to resolve it......?

Upvotes: 1

Views: 54

Answers (1)

codeteq
codeteq

Reputation: 1532

May this can help you:

MSDN EnumerationOptions Class

        // Enumerate the Win32_Processor class
        EnumerationOptions opt = new EnumerationOptions();
        ManagementClass c = new ManagementClass("Win32_Processor");
        foreach (ManagementObject o in c.GetInstances(opt))
        {
            foreach (var item in o.Properties)
            {
                Console.WriteLine(item.Name + " " + item.Value);
            }
        }

Upvotes: 1

Related Questions