Hello,
I need to list all VM:s and their provisioned disk space. I can do it with this command:
get-vm * | foreach-object {write-host "$_`t" (Get-HardDisk -vm $_ | Measure-Object -Property CapacityGB -Sum).sum.ToString()}
(If there is more elegant way to do this, please feel free to enlight me )
The problem is that I'm unable to export this data. Adding
| export-csv ... or
> list.txt
to end of line creates empty file and prints output to console.
How could I make export work correctly (or way I want)?