Script Extracts and Examples (PowerCLI)

From vwiki
Revision as of 14:23, 17 August 2009 by Sstrutt (talk | contribs) (Initial creation + "VM Datastores")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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"