Any update anyone. I am also trying but still now no luck.
And in this script.i am getting Memory is 0 . for all vms. :-( what mistake i did.
And when i execute get-vm | gm
it shows MemoryGB property i but when i used in this script it shows error, how to use that property in this script.