Check Harddrive space and total drive listings for all servers

I have a list of servers (actual servers on our network) that I am returning from a SQL stored procedure query via a datareader - what I would like to do is to cycle through of the of records returened and check and display the harddrive space and drives on each of the servers - Is this even possible and if so, how?
Who is Participating?
RonaldBiemansConnect With a Mentor Commented:
I see the link for WMI was for VB6,

but this is how it is done in .net (don't forget to reference

Public Function GetDiskSpace() As System.UInt64
Dim diskClass As _
New System.Management.ManagementClass("Win32_LogicalDisk")
Dim disks As System.Management.ManagementObjectCollection = _
Dim disk As System.Management.ManagementObject
Dim space As System.UInt64
For Each disk In disks
If CStr(disk("Name")) = "C:" Then
space = CType(disk("FreeSpace"), System.UInt64)
End If
Next disk
Return space
End Function
maybe look ,


or you could use WMI
sorry forgot the link for wmi
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

tbaseflugAuthor Commented:
RonaldBiemans -

How would I displaythe results to a web page?
tbaseflugAuthor Commented:
Also, how would I use the above to reference a harddrive of a remote server?
'create your string from the variables
Dim strOutput as string = disk & " has " & space & " kb Free"
'write it to the page
in the interim before finding out how to  reference the drives on a remote server with code you could map them as local drives and set the permissions for ASPNET. It is not the best solution but certainly the easiest!
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.

All Courses

From novice to tech pro — start learning today.