There is something wrong with the passing of the CapacityGB property over the pipeline.
Try this variation.
Import-Csv -Path 'C:\temp\testvms.csv' | %{
Get-VM -Name $_.Name |
Get-HardDisk -Name 'Hard disk 1' | %{
Set-HardDisk -HardDisk $_ -CapacityGB ($_.CapacityGB + 20) -Confirm:$false
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference