I have to check whether a given node contains any dynamic disk or not and get the list of dynamic disk using Power Shell script. I am not supposed to use diskpart command. Any other solutions other than diskpart will be appreciated.
2 Answers
Get-WmiObject Win32_DiskPartition -filter "Type='Logical Disk Manager'" | Select-Object *
5 Comments
Vicky Gupta
There are other types also which tend to Dynamic disk, below I have listed all possible value of "Type" of a partition.
Vicky Gupta
"Unused", "12-bit FAT", "Xenix Type 1", "Xenix Type 2", "16-bit FAT", "Extended Partition", "MS-DOS V4 Huge", "Installable File System", "PowerPC Reference Platform", "UNIX", "NTFS", "Win95 w/Extended Int 13", "Extended w/Extended Int 13", "Logical Disk Manager", "Unknown"
midacts
reddit.com/r/PowerShell/comments/4dmicj/… Seems like you'd just want to add the other 'Types' you'd want to filter.
Vicky Gupta
but I don't know which type belongs to dynamic and which belong to basic
midacts
the link uses 'Logical Disk Manager'
you may use also diskpart utility, which is easily scriptable (I worked with it in Python) the idea is that when you perform diskpart and then list disk, output will be like:
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 476 GB 0 B *
So you'll see all dynamic disks marked with asterisk under "Dyn"