Getting System information via C#

Hi all,

How do i get information such as NIC Card's Mac Address, Processor Type, Memory Size, etc via C#? It is is not possible via C#, how could i get the information and are there any tutorials for it?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom KnowltonWeb developerCommented:
This does not completely answer your question......but may help get you started:


Network Card: Motorola Wireless PCI Adapter WPCI810G - Packet Scheduler Miniport

    MAC Address: 00:0F:66:1D:F9:E5
    IP Address:
    Subnet Mask:

Here is the source code  (it is a Console application. will need to Add a new Reference to System.Management under the .NET tab)

using System;
using System.Management;

class WMICardGrab
      public static void Main()
            ManagementObjectSearcher query = new
                  ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'") ;
            ManagementObjectCollection queryCollection = query.Get();
            foreach( ManagementObject mo in queryCollection )
                  string[] addresses = (string[])mo["IPAddress"];
                  string[] subnets = (string[])mo["IPSubnet"];
                  string[] defaultgateways = (string[])mo["DefaultIPGateway"];

                  Console.WriteLine("Network Card: {0}", mo["Description"]);
                  Console.WriteLine("    MAC Address: {0}", mo["MACAddress"]);

                  foreach(string ipaddress in addresses)
                        Console.WriteLine("    IP Address: {0}", ipaddress);
                  foreach(string subnet in subnets)
                        Console.WriteLine("    Subnet Mask: {0}", subnet);
                  foreach(string defaultgateway in defaultgateways)
                        Console.WriteLine("    Gateway: {0}", defaultgateway);


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom KnowltonWeb developerCommented:

I will investigate this some more and see if I can give you code that will give you the specific information you are looking for.
Tom KnowltonWeb developerCommented:
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.


To get information about network adapters you can make use of GetAdaptersInfo method of  IpHelper API (Win32) and to get the processor information, there are number of ways but you can have a look at GetSystemInfo method.

Both the methods would require you to declare their equivalent signatures in C#, using .Net interop, something similar to this:

void GetSystemInfo(ref SYSTEM_INFO xyz);

For more details about the C# method signatures for Win32 methods, refer to, which is a great site.

Hope it helps.


eturfclubAuthor Commented:
Thanks knowlton & lavinder ... With your guidiances, I had figured out getting the result i wanted... Thanks lots.. =D
Tom KnowltonWeb developerCommented:

Glad to help.  Kudos to lavinder for finding info on GetAdaptersInfo and IpHelper APIs.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.