Solved

Visual C# advice needed, retreiving windows system information.

Posted on 2006-11-22
6
445 Views
Last Modified: 2013-11-13
Hello all,
I'm a network admin trying to dabble in C# to automate some of my maintenance duties.

I need some pointers on writing a windows application in visual studio 2005 C# that can retreive system statistics (like diskspace, cpu utilisation, memory free) and write the results to an excel spreadsheet or better a sql database.

I am more concerned about the retreval of system info at this stage.

I am reading the Visual studio step by step book at the moment, but need a kick in the right direction.

I look forward to everyones suggestions.
0
Comment
Question by:andrewglendean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Expert Comment

by:YoungBonzi
ID: 18000453
I don't know if this is more than what you want, but take a look at the System.Diagnostics namespace: http://msdn2.microsoft.com/en-us/library/system.diagnostics.aspx
0
 
LVL 2

Expert Comment

by:amiableansari
ID: 18000854

the article shows this with vs 2003. and it displays all the information you get in system information console

http://www.codeproject.com/csharp/NitinSystemInfo.asp
0
 
LVL 5

Expert Comment

by:pdotnet
ID: 18001020
Since you're new to C# and showed interest in storing your data in SQL server, here's a great helper class from Microsoft that fully automates saving and loading data to SQL server.  

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/daab.asp

Data can be read and written in 1 line of code (with the right parameters) using the methods in this class.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
sivachirravuri earned 75 total points
ID: 18001868
Hi,
Please check the following link for sample code & EXE.

http://www.codeproject.com/csharp/nitinsysteminfo.asp

Sample code:

using System;
using System.Management;

...

ManagementObject disk = new
ManagementObject("win32_logicaldisk.deviceid="c:"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + " 
bytes");


0
 
LVL 5

Expert Comment

by:sivachirravuri
ID: 18178883
? ? No comment from Author
0
 
LVL 4

Author Comment

by:andrewglendean
ID: 18197602
Sorry guys, I've been busy with other matters. Thanks to all. I shared my results when ready.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
iframe detection of parent window scale 20 93
Regular Expression Calculator Tester 2 90
How to share My.Settings in multiple application instances ? 7 54
Java List 4 41
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question