PowerTip: Use PowerShell 3.0 CIM Class to Find Logical Disk Info

PowerTip: Use PowerShell 3.0 CIM Class to Find Logical Disk Info

  • Comments 3
  • Likes

Summary: Use the Windows PowerShell 3.0 CIM classes to easily find detailed information about logical disks.

Hey, Scripting Guy! Question How can I use the Windows PowerShell 3.0 CIM classes to easily find detailed information about logical disks?

Hey, Scripting Guy! Answer Use the Get-CimInstance cmdlet to retrieve only the keys from the Win32_LogicalDisk WMI class, and then pipe the results to the Get-CimAssociatedInstance cmdlet:

Get-CimInstance Win32_LogicalDisk -KeyOnly |

Get-CimAssociatedInstance

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Yup! That is actually pretty cool.  A quick snapshot of the disks in one line.  

  • @JRV :-) one logical line -- I broke the line into two lines for readability ;-)

  • @Ed

    I think it is still a physical line from the PowerShell perspective and two from the textual perspective.

    I think the idea of one-liner is very much misunderstood.  Many think adding semi-colons makes a one-liner.  Other think it all has to be on one visual line wrapped 10 times.

    White space has been considered god since early 'C'.  Read K & R.  They created C to ignore all white space and forms control so it could be used to format the display anyway that was needed to make the code readable.

    Assembler and Fortran in those days was horrible.  After C was released all version of Fortran, Cobol and Macro assembler started allowing white space anywhere. ( Fortran and assembler require a character in column 2 in all early version.)