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

0

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 - [PowerShell Tip] Using WMIObject to Check Disk Partitions Info and Block Size

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 Get WmiObject Win32 DiskPartition All Properties 450x379 - [PowerShell Tip] Using WMIObject to Check Disk Partitions Info and Block Size
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 Get WmiObject Win32 DiskPartition Selected Properties 450x188 - [PowerShell Tip] Using WMIObject to Check Disk Partitions Info and Block Size
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 Get WmiObject Win32 DiskPartition Selected Properties Remote Computer 450x188 - [PowerShell Tip] Using WMIObject to Check Disk Partitions Info and Block Size
PowerShell – list partition info on a remote computer

/via:PowerShell.com/

LEAVE A REPLY

Please enter your comment!
Please enter your name here