Programatically monitor diskspace in remote windows servers

I would like to know is there any way to write a program in any language to monitor diskspace of windows remote servers.

i would like make a monitoring webpage to see all the servers which reached the diskspace upto a threshold.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If all of the servers have IIS and access through a public IP, you could have web services on each server that does soemthing like this:

You could then monitor each server by calling the Remote Web Service periodically.

Or vice veersa periodically check the status on the Remote Server and send data to a web service on your local web server.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Yes, you can make wmi calls to get this.  Google on wmi disk space will yield samples.  The biggest problem is usually opening up server security to let the calls through.  I thought I'd suggest you might take think about using one of the free snmp monitoring packages.  They nicely monitor disk space and everything else you might care about, and include various kinds of alerting mechanisms..  I've been using zenoss, but the other ones I see recommended are Big Brother, Nagios, NINO, and OpenNMS.  I presume they all include disk space monitoring.
Alpesh PatelCommented:
If the remote location is on your hand, means on the same network from where you want to run the application then you can go with this one.

Map the drive which you want to monitor on your application machine.... let say its a G:


using System;

using System.Management;


ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid="G:"");


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

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

If the remote machine is on in your hand, means you are not able to access the machine directly then you can create some kind of service using the above code on that machine locally and then use that service remotely .....
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

PeteEngineerAuthor Commented:
Cool this any way make holes in firewal ....or create security concerns ..i am using windows 2003 servers
Alpesh PatelCommented:
which kind of remote calling you are expecting

i think if you are using .net remoting then u dont need to hole firewal
PeteEngineerAuthor Commented:
does the management object a part of remoting?
Alpesh PatelCommented:
no it is just a assemble..... you can use anywhere..... but which kind of firewall hole you want.
PeteEngineerAuthor Commented:
i dont want a hole :-O


just asking whethere it make any security concern and is it possible to monitor SQl server db sizes as well :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.