February 2014
Intermediate to advanced
374 pages
8h 12m
English
You can use the Select-Object cmdlet to select certain properties of the objects that you want to return. For example, you can use the following code to return the name and the used space, in GB, of your virtual machines:
PowerCLI C:\> Get-VM | Select-Object -Property Name,UsedSpaceGB
But what if you want to return the used space in MB? The PowerCLI VirtualMachineImpl object has no UsedSpaceMB property. This is where you can use a calculated property. A calculated property is a PowerShell hash table with two elements: Name and Expression. The Name element contains the name that you want to give the calculated property. The Expression element contains a scriptblock with PowerCLI code to calculate the value of the ...
Read now
Unlock full access