Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Is there any way to get computer's hardware information in c sharp.net.

i.e

Graphics Card
RAM
Processor
HDD Space.

Any help would be highly appreciated.

Thanks

Regards.
Posted

Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search using your subject as the search term gave 25 million hits: Google[^]
The first was this question, the second was an article on this site: Retrieving Hardware Information in C#[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.
 
Share this answer
 
Comments
RaisKazi 10-Oct-12 17:38pm    
My 5!
This is another CodeProject article you could use:
How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^].

How come you could not find any?

[EDIT]

In response to the follow-up discussion:

Yes, graphic card information is missing from this article, but here is what I just came up with:
C#
ManagementObjectSearcher managementObjectSearcher
     = new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
string graphicCardInfo = string.Empty;
foreach (ManagementObject managementObject in managementObjectSearcher.Get()) {
    foreach (PropertyData property in managementObject.Properties) {
        if (property.Value != null)
            graphicCardInfo += string.Format("{0}: {1}{2}",
                property.Name,
                property.Value.ToString(),
                System.Environment.NewLine);
        else
            graphicCardInfo += string.Format("{0}: [UNSUPPORTED]{1}",
                property.Name,
                System.Environment.NewLine);
    }
}
System.Console.WriteLine(graphicCardInfo);


Not that not all cards/drivers will support all properties. Just try it.

—SA
 
Share this answer
 
v2
Comments
Babar_Malik 10-Oct-12 16:29pm    
well Thanks Sergey Alexandrovich Kryukov, I got WMI, but i was bot getting that query, in the code,i thought there may be some easy way to do that, i posted question in simple way.i could have mentioned that.
Thanks
Sergey Alexandrovich Kryukov 10-Oct-12 16:47pm    
Does the author's code work for you or not? If not, what's the problem?
--SA
Babar_Malik 10-Oct-12 16:49pm    
yes it worked, my main issue is that i want my graphics card's memory, i am getting graphics card model, but i am not getting total memory of my gfx card.
Sergey Alexandrovich Kryukov 10-Oct-12 17:14pm    
Got it. Then -- please see my update to the answer, after [EDIT]. All the management can deliver to you is probably there. Better now?
If so, please accept the answer formally (green button).
--SA
Babar_Malik 10-Oct-12 17:36pm    
Thats very much near to my solution, still striving to get exact thing... but your answer is very close to what i am looking far.
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900