Skip to main content
Fix command typo for "Get-StoragePool" instead of "GetStoragePool" and add single line command
Source Link

The answer to this problem was embarrassingly simple. Coming from an object-oriented background to Powershell seems to have both advantages and disadvantages, as I was searching for the answer from completely the wrong direction. The answer is to use the -StoragePool parameter to the Get-PhysicalDisk cmdlet, as in:

$pool=GetStoragePool$pool=Get-StoragePool -FriendlyName "MyPool"
$disks=Get-PhysicalDisk -StoragePool $pool

Or in one line

Get-PhysicalDisk -StoragePool (Get-StoragePool -FriendlyName "MyPool")

The answer to this problem was embarrassingly simple. Coming from an object-oriented background to Powershell seems to have both advantages and disadvantages, as I was searching for the answer from completely the wrong direction. The answer is to use the -StoragePool parameter to the Get-PhysicalDisk cmdlet, as in:

$pool=GetStoragePool -FriendlyName "MyPool"
$disks=Get-PhysicalDisk -StoragePool $pool

The answer to this problem was embarrassingly simple. Coming from an object-oriented background to Powershell seems to have both advantages and disadvantages, as I was searching for the answer from completely the wrong direction. The answer is to use the -StoragePool parameter to the Get-PhysicalDisk cmdlet, as in:

$pool=Get-StoragePool -FriendlyName "MyPool"
$disks=Get-PhysicalDisk -StoragePool $pool

Or in one line

Get-PhysicalDisk -StoragePool (Get-StoragePool -FriendlyName "MyPool")
Source Link

The answer to this problem was embarrassingly simple. Coming from an object-oriented background to Powershell seems to have both advantages and disadvantages, as I was searching for the answer from completely the wrong direction. The answer is to use the -StoragePool parameter to the Get-PhysicalDisk cmdlet, as in:

$pool=GetStoragePool -FriendlyName "MyPool"
$disks=Get-PhysicalDisk -StoragePool $pool