Listing "Real" Hard Drives

by Nov 25, 2013

WMI can provide lots of information about a system, but sometimes it is just a bit too much. So when you query for logical disks, you often get back many more than just the physical ones.

Setting an additional filter will do. This line returns only physical drives by making sure that only instances with a DriveType=3 are returned:

Since Get-WmiObject has a parameter -ComputerName, you can get this information remotely as well. And if you'd like to know what other drive types are there, simply remove the filter or visit a preferred search engine and search for "Win32_LogicalDisk DriveType".

Twitter This Tip! ReTweet this Tip!