Learn about Windows PowerShell
Summary: Use the Windows PowerShell 3.0 CIM classes to easily find detailed information about logical disks.
How can I use the Windows PowerShell 3.0 CIM classes to easily find detailed information about logical disks?
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 |
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 ;-)
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.)