?
Solved

Visual C# advice needed, retreiving windows system information.

Posted on 2006-11-22
6
Medium Priority
?
447 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
Technology Partners: 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 225 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

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!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Make the most of your online learning experience.
Six Sigma Control Plans
Introduction to Processes
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 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