Determining Disk Type with Get-PhysicalDisk

After today, you are going to know that determining disk type with Get-PhysicalDisk is super easy.

If you recently watched our PDQ & A webcast, you may have seen that we were unable to answer a question about how to determine if a disk is a solid state drive (SSD) or not.

Fast forward to now and we have that answer by utilizing Get-PhysicalDisk cmdlet.

Thanks PowerShell!

Gathering Physical Disk Information with Get-PhysicalDisk

If you’re using Windows 8 or later, you can get all the information you could ever want to know about your physical disk but were afraid to ask by running this (very) simple command:

Get-PhysicalDisk | Select *

Blog - SSD or not - Get-PhysicalDisk example with all properties

Try PDQ Inventory

Determining Disk Type with Get-PhysicalDisk

Armed with this new knowledge, of how to use Get-PhysicalDisk, let’s find out which (if any) of my physical disks are SSD.

Get-PhysicalDisk | Select FriendlyName, MediaType

Blog - SSD or not - Get-PhysicalDisk example

Ta da!  Like magic, you can now determine your disk types!  That is, only if you’re using Windows 8 or higher. Should you happen to be stuck on older versions of windows, then you’ll just have to pretend to follow and/or sing along.

By default, just running Get-PhysicalDisk will not get you the MediaType, so be sure to select it specifically.

That’s it. We’re done. You can go home now and show off your new and powerful knowledge to your friends and neighbors.

There’s nothing more to see here. That is, unless you want to learn more! *gasp!*

Slightly Deeper Dive

Since it’s not a true deep dive, perhaps we should call this the casual saunter into the the shallow end of the pool of knowledge. If you’re still reading this far, we’ll show you the class that Get-PhysicalDisk appears to be using to gather those fancy properties.

In addition to the Get-PhysicalDisk cmdlet, we found that the MSFT_PhysicalDisk appears to provide exactly what we’re looking for (link about the class). Knowing the class, here is how you would query that information with PowerShell:

Get-WmiObject -Class MSFT_PhysicalDisk -Namespace root\Microsoft\Windows\Storage  | Select FriendlyName, MediaType

Blog - SSD or not - MSFT_PhysicalDisk example

Unsurprisingly, this looks very similar to the result we got with Get-PhysicalDisk. Now, we just need to know what the media types 3 and 4 actually mean.

Based on this page about the MSFT_PhysicalDisk class (link here – Look for MediaType section), we can see which media types are available and what their values mean.

3 = HDD
4 = SSD

Since we know what these values now mean, we can modify our PowerShell above to use some calculated properties (fancy!) and include a simple switch statement to display friendlier results. Joy!

Get-WmiObject -Class MSFT_PhysicalDisk -Namespace root\Microsoft\Windows\Storage | 
     Select FriendlyName,
             switch ($_.MediaType) { 
                 3 {"HDD"}
                 4 {"SSD"} 

Blog - SSD or not - MSFT_PhysicalDisk example with calculated propertie

Running the code above will show each physical disk and the associated media type. Amazing!

Alternatively, you could break this into multiple commands instead of the single command. But, that would have robbed me of the opportunity to use calculated properties.

Wrapping up

Like I mentioned before, I recommend that you use the first example since it’s much easier to remember and use:

Get-PhysicalDisk | Select FriendlyName, MediaType

As Always, go forth and PowerShell!


Buy PDQ Inventory

4 responses

    • Oh man! That’s most unfortunate!

      If you happen to know what the media type of the drive is supposed to be, you should be able to use the Set-PhysicalDisk cmdlet to change that.

      Thanks for the comment!

    • Good news! We added this as a feature to PDQ Inventory in version 12, release 3.

      If you’re using PDQ Inventory 12, release 3 or later, this information is available in the Disk Drives page in the Computer window!

      Here’s a link to our help docs about that ( The column is called Physical Disk Type.

      Please be aware that this Physical Disk information isn’t available for targets that are using versions of Windows prior to Windows 8. The MSFT_PhysicalDisk WMI class was introduced in Windows 8 / Server 2012.

      I hope this helps!


Your email address will not be published.

Your Name

This site uses Akismet to reduce spam. Learn how your comment data is processed.