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.
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:
Armed with this new knowledge, of how to use Get-PhysicalDisk, let’s find out which (if any) of my physical disks are SSD.
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!*
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. Knowing the class, here is how you would query that information with PowerShell.
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!
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.
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!
Kris was an employee at PDQ.