Home/PowerShell, Powershell demo/Viewing Your Drive Information with PowerShell – Part 1

Viewing Your Drive Information with PowerShell – Part 1

Managing drives, monitoring space to ensure that a drive run out of available capacity and to understanding just how many drives are on a single system this are simply able to monitor using PowerShell instead of manual monitoring. WMI – Windows Management Instrumentation can be a wealth of information that anyone should be able to query to get pretty much whatever  information they need.

In this post, we going to discuss about very simple query to get the Drive information. You can run the below query using the Get-WMIObject cmdlet to get more information about all of the drives on your system. From the above output, you can able to see that we have the DeviceID, which is the drive letter assigned to the drive; the FreeSpace, which is measured in bytes, as well as the capacity (size) of the drive; along with the volume name that has been specified.

Using the above information you can able to easily filter using the query for only drives that matched a certain type and while viewing the size in bytes is necessary to keep the size at the lowest possible level, sometimes it is nice to see it in a more  readable format, such as in GB like below, The property is specified by a hash table with two keys, Label and Expression.The name of the property is assigned to the Label key. The calculation is assigned to the Expression key.


Leave a Reply