powercli - Powershell : unable to add the members to collections -
i face problem in following test script. expect following result output of it.
vm name vcpu memory ------- ---- ------ server1 1 server2 8
unfortunately, receiving following output. can me understand mistake in code?
enter code here vm name vcpu ------- ---- server1 1 server2
$obj_collection = @() $report_data = new-object system.object $report_data | add-member -membertype noteproperty -name "vm name" -value "server1" $report_data | add-member -membertype noteproperty -name "vcpu" -value "1" $obj_collection += $report_data $report_data = new-object system.object $report_data | add-member -membertype noteproperty -name "vm name" -value "server2" $report_data | add-member -membertype noteproperty -name "memory" -value "8" $obj_collection += $report_data $obj_collection
this? need add apple apple because apple potatoes can give strange behaviour
$obj_collection = @() $report_data = new-object system.object $report_data | add-member -membertype noteproperty -name "vm name" -value "server1" $report_data | add-member -membertype noteproperty -name "vcpu" -value "1" $report_data | add-member -membertype noteproperty -name "memory" -value $null $obj_collection += $report_data $report_data = new-object system.object $report_data | add-member -membertype noteproperty -name "vm name" -value "server2" $report_data | add-member -membertype noteproperty -name "vcpu" -value $null $report_data | add-member -membertype noteproperty -name "memory" -value "8" $obj_collection += $report_data $obj_collection
Comments
Post a Comment