473,750 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get System Specs (memory, processor etc...) in C#?

Hello,

I would like to know how to find the specs of the current running system
such as the memory amount and processor speed in C#?

Mateusz

Mar 6 '06 #1
1 3476
Hello Mateusz,

use WMI for this. (call wmic.exe and type "cpu", "memlogical " for example
to see info)
To get info abt physical memmory use samble below. For CPU use "SELECT *
FROM Win32_Processor "

static void Main(string[] args)
{
double totalCapacity = 0;
ObjectQuery objectQuery = new ObjectQuery("se lect * from
Win32_PhysicalM emory");
ManagementObjec tSearcher searcher = new
ManagementObjec tSearcher(objec tQuery);
ManagementObjec tCollection vals = searcher.Get();
foreach(Managem entObject val in vals)
{
totalCapacity += System.Convert. ToDouble(val.Ge tPropertyValue( "Capacity") );
}

Console.WriteLi ne("Total Machine Memory = " + totalCapacity.T oString() + "
Bytes");
Console.WriteLi ne("Total Machine Memory = " + (totalCapacity / 1024) + "
KiloBytes");
Console.WriteLi ne("Total Machine Memory = " + (totalCapacity / 1048576) + "
MegaBytes");
Console.WriteLi ne("Total Machine Memory = " + (totalCapacity / 1073741824 )
+ " GigaBytes");
Console.ReadLin e();

}
MR> Hello,
MR>
MR> I would like to know how to find the specs of the current running
MR> system such as the memory amount and processor speed in C#?
MR>
MR> Mateusz
MR>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1561
by: Mitch Olson | last post by:
Hi our company is just about to embark on developing a PIM-type application and would like to use .NET (VB6 is our distant option 2). The question we are currently investigating is whether the minimum machine requirements (processor speed & memory) will rule out too much of our target market (the universe of Windows users, well at least W98+ users). Our primary question is what is the minimum specification of a machine to run a...
7
8104
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: private void Page_Load(object sender, System.EventArgs e) { // load content XslTransform trans = new XslTransform();
15
1927
by: puzzlecracker | last post by:
Got Confused on the interview with memory alligment questions... PLEASE HELP -- How much bytes of memory will structs below take on 32 bit machine? What about 64 bit machine? Why is it different? (if it's relevent, use standard size of datatypes) a) Code: struct
5
7856
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated), after some investgation i found out that most of it being consumed by filesystem caching... thanks to Liam and Phil Sherman for their valuable suggestions. Is it safe to turn off filesystem caching on every tablespaceon the server(i.e. DIO) ??...
1
2397
by: Sek | last post by:
Hi, Is there any namespace/class in C# to get the system configuration details such as RAM size, HDD capacity, processor details and things like that. I went through the ManagementObject class, but that uses specific names/labels to get specific property. I couldn't find any way to read the processor/memory details using it. I did come across a way to find the HDD capacity information using it.
17
2720
by: Christian Wittrock | last post by:
Hi, What does ANSI C say about casting an 8 bit pointer to a 16 bit one, when the byte pointer is pointing to an odd address? I have detected a problem in the Samsung CalmShine 16 compiler. This compiler I use for the Samsung 16 bit Smartcard chips and I want to know if it is compliant with the ANSI standard or if it violates it. Have a look at this super simple example, where the value of b is incorrect:
4
1641
by: DanielGifford | last post by:
Hi I'm making some basic cryptography software and I've run into a snag. I'm trying to retrieve some sort of system number thats specific to the system I'm working on. It can't change over time. Whether its a cpu id, memory id, system serial key, or anything else
8
1863
by: Gerhard Fiedler | last post by:
Hello, I'm not sure whether this is a problem or not, or how to determine whether it is one. Say memory access (read and write) happens in 64-bit chunks, and I'm looking at 32-bit variables. This would mean that either some other variable is also written when writing a 32-bit variable (which means that all access to 32-bit variables is of the read-modify-write type, affecting some other variable also), or that all 32-bit variables are...
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.