Link to home
Start Free TrialLog in
Avatar of ADhiman
ADhiman

asked on

How to get the free space of a hard drive

How to get  the free space  of network PC's hard drive (i have three PC in network i want to get free space of other two PC,s through VB6)
Avatar of Shiju S
Shiju S
Flag of United States of America image

Avatar of ADhiman
ADhiman

ASKER

i have PC Based upon IP address
is there any solution Like(i will put IP address of that PC and  drive name it will show free space)
Hi, ADhiman.

This solution may help you.  I slightly modified the code found at (https://www.experts-exchange.com/questions/20064358/Get-a-list-of-local-Network-Drives.html?query=drive+free+space&topics=93):

Private Sub CommandButton1_Click()
On Error GoTo Errorhandler

    Dim fso As New Scripting.FileSystemObject, dr As Scripting.Drive
    For Each dr In fso.Drives
        MsgBox "Drive letter:           " & dr.DriveLetter & vbNewLine & "Drive Total Size:     " & Format(dr.TotalSize, "#0,000") _
        & " Bytes" & " / " & Format(dr.TotalSize / 1000000000, "#0.00") & " GB" & vbNewLine & "Drive free space     " & Format(dr.FreeSpace, "#0,000") & " Bytes" _
        & " / " & Format(dr.FreeSpace / 1000000, "#0.00") & " MB"
    Next
    Exit Sub
   
Errorhandler:
    MsgBox "Drive letter: " & dr.DriveLetter & "--not ready."
    Resume Next

End Sub

ASKER CERTIFIED SOLUTION
Avatar of edwardiii
edwardiii

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