Forum Discussion
Todd_Lange
Jan 21, 2022Copper Contributor
How can I filter the result of Get-PhysicalDisk by both CanPool=$True and IsPartial=$False
I'm just learning PowerShell, so I'm a bit green. I want to filter the output of Get-PhysicalDisk by 'CanPool=$True and IsPartial=$False' and use that as the input argument to New-StoragePool in ...
Todd_Lange
Jan 21, 2022Copper Contributor
FYI - Maybe not very elegant, but I found this works:
$PhysicalDisks = Get-PhysicalDisk -CanPool $true
$PhysicalDisksFiltered = @()
foreach ($disk in $PhysicalDisks) {
if ($disk.IsPartial -ne $true) {
$PhysicalDisksFilter += $disk
}
}
$StoragePool = New-StoragePool -FriendlyName "DataStoragePool" -StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks $PhysicalDisksFiltered