---
title: "How can I get operating system name and processor name using C#."  
description: "How can I get operating system name and processor name using C#."  
author: "James Smith"  
published: 2011-05-18  
updated: 2011-05-19  
canonical: https://www.mindstick.com/forum/248/how-can-i-get-operating-system-name-and-processor-name-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How can I get operating system name and processor name using C#.

Hi...

I have a small [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) that how can I display [operating system](https://www.mindstick.com/articles/229069/operating-system-development) information such as operating [system name](https://www.mindstick.com/forum/159067/how-to-check-the-operating-system-name-and-version-in-python) , [service](https://www.mindstick.com/articles/105963/online-thesis-writing-service-for-college-kids-with-disabilities) pack and [processor](https://www.mindstick.com/news/2830/qualcomm-s-snapdragon-8-gen-3-processor-might-arrive-earlier-than-expected) information such as name etc by using c#.

Help me as soon as possible.

Thanks.

## Replies

### Reply by Ravi Vishwakarma

I hope it helps you.

```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
//This namespace is used to work with WMI classes. For using this namespace add reference of System.Management.dll .using Microsoft.Win32;
//This namespace is used to work with Registry editor.namespace OperatingSystemInfo1{
class TestProgram {
  static void Main(string[] args) {
    SystemInfo si = new SystemInfo();
    //Create an object of SystemInfo class.
    si.getOperatingSystemInfo();
    //Call get operating system info method which will display operating system information.
    si.getProcessorInfo();
    //Call get  processor info method which will display processor info.
    Console.ReadLine();
    //Wait for user to accept input key.
  }

}
public class SystemInfo {
  public void getOperatingSystemInfo() {
    Console.WriteLine("Displaying operating system info....\n");
    //Create an object of ManagementObjectSearcher class and pass query as parameter.
    ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_OperatingSystem");
    foreach(ManagementObject managementObject in mos.Get()) {
      if (managementObject["Caption"] != null) {
        Console.WriteLine("Operating System Name  :  " + managementObject["Caption"].ToString());
        //Display operating system caption
      }

      if (managementObject["OSArchitecture"] != null) {
        Console.WriteLine("Operating System Architecture  :  " + managementObject["OSArchitecture"].ToString());
        //Display operating system architecture.
      }
      if (managementObject["CSDVersion"] != null) {
        Console.WriteLine("Operating System Service Pack   :  " + managementObject["CSDVersion"].ToString());
        //Display operating system version.
      }

    }
  }
  public void getProcessorInfo() {
    Console.WriteLine("\n\nDisplaying Processor Name....");
    RegistryKey processor_name = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0", RegistryKeyPermissionCheck.ReadSubTree);
    //This registry entry contains entry for processor info.
    if (processor_name != null) {
      if (processor_name.GetValue("ProcessorNameString") != null) {
        Console.WriteLine(processor_name.GetValue("ProcessorNameString"));
        //Display processor ingo.
      }
    }
  }
}
}
```

**Thank you.**

### Reply by Anonymous User

Hi...

\

https://www.mindstick.com/blog/176/displaying-computer-[system](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business)-information-using-c-sharp\

\

**This link might be helpful for you.**


---

Original Source: https://www.mindstick.com/forum/248/how-can-i-get-operating-system-name-and-processor-name-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
