?
Solved

Can Total Size and Free Space of Local Disks be obtained from window registry?

Posted on 2011-03-07
4
Medium Priority
?
325 Views
Last Modified: 2012-05-11
Would like to get the Total Size and Free Space of Local Disk like C:\ or D:\. The info must be saved in window registry. How to retrieve the info??
0
Comment
Question by:jl66
[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
  • 2
4 Comments
 
LVL 2

Assisted Solution

by:grossac
grossac earned 800 total points
ID: 35060809
You can use WMI to query the data and calculate free space.

Use the Win32_LogicalDisk class and the FreeSpace property.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk")
For Each objDisk in colDisks
    Wscript.Echo "DeviceID: " & objDisk.DeviceID      
    Wscript.Echo "Free Disk Space: " _
        & objDisk.FreeSpace
Next


AND

 Use the Win32_LogicalDisk class, and the Size property.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk")
For Each objDisk in colDisks
    Wscript.Echo "DeviceID: " & objDisk.DeviceID      
    Wscript.Echo "Disk Size: " & objDisk.Size
Next


Here's a link to several other items you can get...
http://msdn.microsoft.com/en-us/library/aa394592(v=vs.85).aspx
0
 
LVL 19

Accepted Solution

by:
Thommy earned 1200 total points
ID: 35060970
You cannot find such information in the registry.

Use this script to retrieve disk and drive infoirmation...
http://www.pcreview.co.uk/forums/finding-hard-disk-information-registry-t3711144.html

diskinfo.vbs
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 1200 total points
ID: 35061065
You can also use WinApi-function GetDiskFreeSpace to retrieve info about a specified disk...

GetDiskFreeSpace Function
http://msdn.microsoft.com/en-us/library/aa364935(v=vs.85).aspx

You can call API functions from nearly all programming languages (e. g. Delphi, Visual Basic, C...)
0
 

Author Closing Comment

by:jl66
ID: 35065938
Thanks both. I thought the local drive info must be saved in registry in local computer.Perhaps not.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

764 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