Finding Hard disk information from registry

S

Syedi123

Hi,
Is it possible to Find Hard disk information like total size, partitions,
total and free size of each partition from registry (Regedit)?


Thanks in Advance
 
P

Pegasus \(MVP\)

Syedi123 said:
Hi,
Is it possible to Find Hard disk information like total size, partitions,
total and free size of each partition from registry (Regedit)?


Thanks in Advance

I don't think that such information is held in the registry but you can
extract it with the script below. Here is what you need to do:
- Copy & paste the script into c:\DiskParms.vbs.
- Click Start / Run / cmd {OK}
- Type this command:
cscript //nologo c:\DiskParms.vbs

aDType = split("Unknown Removable Fixed Network CDROM RAMDisk")
Set oFSO = CreateObject("Scripting.FileSystemObject")
LF = Chr(10)

sLine = "Drive Type State Label F/S Size Free
Serial"
WScript.Echo sLine
WScript.Echo String(Len(sLine)+2, "-")
For Each oDrive In oFSO.Drives
D = oDrive.DriveType
if D > UBound(aDType) then D = 0
sLine = oDrive.Path & " " & aDType(D)

If oDrive.IsReady Then
sLine = Append(sLine, "ready", 18, False)
If oDrive.DriveType = 3 Then
sLine = Append(sLine, Left(oDrive.ShareName, 13), 29, False)
Else
sLine = Append(sLine, Left(oDrive.VolumeName, 13), 29, False)
End If

sLine = Append(sLine, oDrive.FileSystem, 44, False)
sLine = Append(sLine, Int(oDrive.TotalSize/1000000), 51, True)
sLine = Append(sLine, Int(oDrive.FreeSpace/1000000), 59, True)
sLine = Append(sLine, Hex(oDrive.SerialNumber), 67, False)
Else
sLine = Append(sLine, "not ready", 18, False)
End If
WScript.Echo sLine
Next

Function Append(L, S, n, numerical)
if n < Len(L) + 2 then n = 2 Else n = n - Len(L)
If numerical Then
Append = L & Left(Space(60), n + 6 - Len(S)) & S
Else
Append = L & Left(Space(60), n) & S
End If
End Function
 
S

Syedi123

Thanks for reply,
I am developing a program in C#.NET 2.0 which will mount remote disk and
from its registry it should fetch disk total size and free size. so is it
possible to get such information from registry only?

Thanks
 
T

Tim Slattery

Syedi123 said:
Thanks for reply,
I am developing a program in C#.NET 2.0 which will mount remote disk and
from its registry it should fetch disk total size and free size. so is it
possible to get such information from registry only?

In that case, you should ask in a programming group
(ms.public.dotnet.languages.csharp maybe). It's not in the registry
but it's certainly available programmatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top