Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Visual C# advice needed, retreiving windows system information.

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.
1 Solution
I don't know if this is more than what you want, but take a look at the System.Diagnostics namespace:

the article shows this with vs 2003. and it displays all the information you get in system information console
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.

Data can be read and written in 1 line of code (with the right parameters) using the methods in this class.
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

sivachirravuriTeam Lead Commented:
Please check the following link for sample code & EXE.

Sample code:

using System;
using System.Management;


ManagementObject disk = new
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + " 

sivachirravuriTeam Lead Commented:
? ? No comment from Author
andrewglendeanAuthor Commented:
Sorry guys, I've been busy with other matters. Thanks to all. I shared my results when ready.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now