[PowerShell Tip] Using WMIObject to Check Disk Partitions Info and Block Size

Here is a quick PowerShell tip that is going to be quite useful to reveal more information about your partitions setup on your computer, as information such as block size is not easy to get from the GUI tools.

The following basic cmdlet will read the local partitions and list all of them on the screen for you.

Get-WmiObject -Class Win32_DiskPartition

PowerShell - Get-WmiObject Win32-DiskPartition

Note that the information listed above are quite basic. To get a full list of properties about your partitions on your computer, run this:

Get-WmiObject -Class Win32_DiskPartition | Select-Object -Property *

PowerShell - all properties about your partitions

PowerShell – all properties about your partitions

And of course, you can select certain properties you want to check as well. Simply type in the name of the properties, separate by comma, to replace the * in the command above. For example, the cmdlet below only lists the name of the machine, the caption of the partition, the blocksize, as well as whether is bootable.

Get-WmiObject -Class Win32_DiskPartition | Select-Object -Property PSComputerName, Caption, BlockSize, Bootable

PowerShell - selected properties about your partitions

PowerShell – selected properties about your partitions

What’s amazing is that you can even use the same cmdlet to query the information from a remote computer which you have the permission to access, by simply adding a switch -ComputeName followed by the name of the remote computer. For example,

Get-WmiObject -Class Win32_DiskPartition -ComputerName anothercomputer | Select-Object -Property PSComputerName, Caption, BlockSize, Bootable

PowerShell - list partition info on a remote computer

PowerShell – list partition info on a remote computer

/via:PowerShell.com/

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 08/04/2014

Posted in: Tips & Tricks
Discover more: , ,