Solved

Visual C# advice needed, retreiving windows system information.

Posted on 2006-11-22
6
433 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pairs challenge 5 66
wordmultiple challenge 12 121
firstswap challenge 20 68
drawing animated level bar based on numbers 3 88
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

896 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now