https://barnamenevis.org/showpo...&postcount=115

ابتدا System.Management رو به References پروژه بیفزایید و سپس :
کد:


Imports System.Management

Public Function getHDDSize(ByVal drive As String) As Double

' //check to see if the user provided a drive letter
' //if not default it to "C"
If drive = "" Or drive Is Nothing Then

drive = "C"
End If
'//create our ManagementObject, passing it the drive letter to the
'//DevideID using WQL
Dim disk As ManagementObject = New ManagementObject("Win32_LogicalDisk.DeviceID=""" + drive + ":\""")
'//bind our management object
disk.Get()
'//return the HDD's initial size
Return Convert.ToDouble(disk("Size"))
End Function