I obtain the available raw disks on my VM by using
$availDisks = Get-PhysicalDisk -CanPool $true
The $availDisks contains 3 RAW disks I would like to effectively compare the size of the disks, and if they are the same size, to stripe them.
$availDisks.Size gives me the output of the 3 disks, but I need to compare each one of them.
The method I used is
$size = $availDisks[0].size
foreach($disk in $availDisks){
if($disk.size -eq $size){
Write-Host "The disk is equal to the desired size"
continue with the disk striping
}else{
Write-Error "One of the disks is not matching the size"
Do something else
}
}
Is there a more effective method?