Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-07
4
Medium Priority
?
330 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Loops Section Overview
Suggested Courses

597 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