Solved

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

Posted on 2001-08-29
14
382 Views
Last Modified: 2008-02-01
How can I do this in my web-application? I have the servernames or IP-adresses.

Thnx.
0
Comment
Question by:ironeye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
  • +1
14 Comments
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6436057
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!
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6436060
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
0
 

Author Comment

by:ironeye
ID: 6436064
That would mean I have to map all drives of each server to the webserver?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6436102
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!
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6436108
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?
0
 

Author Comment

by:ironeye
ID: 6436117
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.
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6436157
Pass then. If there is, I don't know what it is. Maybe it's VB. Have you checked out MSDN Library?
0
 
LVL 11

Expert Comment

by:thunderchicken
ID: 6437704
You can not use FSO on mapped drives because they are a service.

Have you tried using the UNC path, ie \\Computername
0
 
LVL 5

Expert Comment

by:raizon
ID: 6438245
You can get all the partition information using WMI Scripting
0
 

Author Comment

by:ironeye
ID: 6439253
raizon, that's new to me. Do u have a example for me?
0
 
LVL 5

Expert Comment

by:raizon
ID: 6442984
yes I do but I won't be able to get it for you until tomorrow at work.  I'll post it here.
0
 
LVL 5

Accepted Solution

by:
raizon earned 100 total points
ID: 6446308
Give this a shot.  YOu do need to have administrative access so make sure to set basic authentication in IIS for this.  Set vComputerName to the name of the server you want to check.

<%
Function ShowDiskPartition(vComputerName)
     Dim objLocator, objService, objWEBMCol, objWEBM
     Set objLocator = CreateObject("WbemScripting.SWbemLocator")
     
     'Establish a connection to WMI
     If isEmpty(vComputerName) = True then
          Set objService = objLocator.ConnectServer
     Else
          Set objService = objLocator.ConnectServer(vComputerName)
     End If
     
     'Get the Webm Service object
     Set objWEBMCol = objService.InstancesOf("Win32_DiskPartition")
     Response.write "<H2> Disk Partition:</H2><HR><UL>"
     
     'Enumerate
     For Each objWEBM in objWEBMCol
          Response.write "<LI>Availability: " & objWEBM.Availability
          & _ ", <BR>Caption: " & objWEBM.Caption
          & _ ", <BR>Block Size: " & objWEBM.BlockSize
          & _ ", <BR>Bootable: " & objWEBM.Bootable
          & _ ", <BR>Boot Partition: " & objWEBM.BootPartition
          & _ ", <BR>Description: " & objWEBM.Description
          & _ ", <BR>Device ID: " & objWEBM.DeviceID
          & _ ", <BR>Disk Index: " & objWEBM.DiskIndex
          & _ ", <BR>Hidden Sectors: " & objWEBM.HiddenSectors
          & _ ", <BR>Number Of Blocks: " & objWEBM.NumberOfBlocks
          & _ ", <BR>Plug and Play device identifier: " & objWEBM.PNPDeviceID
          & _ ", <BR>Power Management Supported: " & objWEBM.PowerManagementSupported
          & _ ", <BR>Primary Partition: " & objWEBM.PrimaryPartition
          & _ ", <BR>Size: " & objWEBM.Size
          & _ ", <BR>Starting Offset: " & objWEBM.StartingOffset
          & _ ", <BR>Status: " & objWEBM.Status
          & _ ", <BR>System Name: " & objWEBM.SystemName
          & _ ", <BR>Type: " & objWEBM.Type & "<BR></LI>"
     Next
     Response.write "</UL>"
     'Clean up
     Set objLocator = Nothing
     Set objService = Nothing
     Set objWEBMCol = Nothing
     Set objWEBM = Nothing
End Function

Call ShowDiskPartition(vComputerName)
%>
0
 
LVL 5

Expert Comment

by:raizon
ID: 6453060
Thanks for the points and the grade.  Did this do what you need?
0
 

Author Comment

by:ironeye
ID: 6453063
Yep! Great.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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