Link to home
Start Free TrialLog in
Avatar of ironeye
ironeye

asked on

Get disksize and free space of hd's from remote server

How can I do this in my web-application? I have the servernames or IP-adresses.

Thnx.
Avatar of AlfaNoMore
AlfaNoMore

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Drives = objFSO.Drives
For Each Drive in Drives
   Drive.AvailableSpace 'size of HD
   Drive.FreeSpace 'you guessed it :-)
Next

You can connect to any drive that is networked to your server. Map a network connection to the external machine if needed.

Seems you can't go direct to the drive using objFSO.GetDrive("D:\"), which would have been good, instead you'll have to loop through all available until you find the right one!
Here's the full property list for the Drives object:

Drive.AvailableSpace
Drive.DriveLetter
Drive.DriveType
Drive.FileSystem
Drive.FreeSpace
Drive.IsReady
Drive.Path
Drive.SerialNumber
Drive.ShareName
Drive.TotalSize
Drive.VolumeName
Avatar of ironeye

ASKER

That would mean I have to map all drives of each server to the webserver?
That would be the whole point of Network security! You can't just access any drive remotely without permission -- unless you create your own hacking software? You probably could execute a registry key for each drive (which maps it), and then clean it up afterwards, but that's not any easier than mapping it yourself!
And you might not want to perform this check everytime anyway. You might think about performing the check once a day or something to free up resources. Save the results to a text file, and each use can read from that?
Avatar of ironeye

ASKER

It's for a server inventory tool so that the IT department can look if a harddisk is running full without having to use the SMS-service. I've seen it done in perl so I wondered if it could be done with ASP/VBs.
Pass then. If there is, I don't know what it is. Maybe it's VB. Have you checked out MSDN Library?
You can not use FSO on mapped drives because they are a service.

Have you tried using the UNC path, ie \\Computername
You can get all the partition information using WMI Scripting
Avatar of ironeye

ASKER

raizon, that's new to me. Do u have a example for me?
yes I do but I won't be able to get it for you until tomorrow at work.  I'll post it here.
ASKER CERTIFIED SOLUTION
Avatar of raizon
raizon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points and the grade.  Did this do what you need?
Avatar of ironeye

ASKER

Yep! Great.