Script Extracts and Examples (PowerCLI)

From vwiki
Revision as of 14:42, 17 August 2009 by Sstrutt (talk | contribs) (Minor correction)
Jump to navigation Jump to search

Before being able to use any the following script you need to install...

VM Datastores

List of Virtual Machines, and their datastores (with usage)

$datastoreExp = @{N="Datastore"; E={ ($_ | get-datastore | select-object -first 1).Name }}
$diskSizeExp = @{N="Total Disk"; E={ ($_ | get-harddisk | measure-object -property CapacityKB -sum).Sum }}
get-vm | select Name, $datastoreExp, $diskSizeExp | sort -property Datastore,"Total Disk"