Solved

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

Posted on 2001-08-29
14
381 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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