Difference between revisions of "Script Extracts and Examples (PowerCLI)"

Jump to navigation Jump to search
m
Typo fix
(Initial creation + "VM Datastores")
 
m (Typo fix)
 
(99 intermediate revisions by the same user not shown)
Line 1: Line 1:
Before being able to use any the following script you need to install...
#REDIRECT [[:Category:PowerCLI]]
* [http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx Windows PowerShell]
* [http://www.vmware.com/go/powershell VI Toolkit]
 
== 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"</code>

Navigation menu