I would like to write a PowerCLI script, which gather VMs memory information from vCenter Server. I realized that if I put one of the VM into a variable, it have different property on different PowerCLI versions. I develop the script on PowerCLI 5.1 Release 1, and I run it on PowerCLI 5.0.1, and the result was not fine.
I put the VM in a $vm variable, and get the variable property with get-member. Here is the script part.
$vm = Get-VM -Name testsrv $vm |gm
Here are the two screenshots.
After this I must use only the MemoryMB to avoid the version differences error.