Disks Part 3
Posted by: Richard Siddaway
We have seen how to use Win32_DiskDrive to look at our physical disks but this isn’t the whole story. We also need to consider logical disks or volumes
|
001
002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 |
$dtype = DATA {
ConvertFrom-StringData -StringData @’ 0 = Unknown 1 = No Root Directory 2 = Removable Disk 3 = Local Disk 4 = Network Drive 5 = Compact Disk 6 = RAM Disk ‘@ } $media = DATA { Get-WmiObject -Class Win32_LogicalDisk | |
We have a class called Win32_LogicalDisk for that. The properties are named so they are self explanatory. There are a couple of lookups to replace numeric values with text and a couple of calculations.
When you run this notice that we get information for CD drives as well – but we don’t on the physical disks. One of the nice pieces of consistency in WMI!
The problem we face next is how to link our physical disk information with our logical disk information i.e. which logical disks are on which physical disk.




