Friday, 7 August 2015
PowerCLI - VM manipulation
How to get vCPU count of all powered on VMs of particular ESX host
Get-VMHost -Name HostName | get-vm | Where {$_.PowerState -eq "PoweredOn"} | Measure-Object -Property NumCpu -Sum | select -ExpandProperty Sum
How to get count of all powered on VMs of particular ESX host
$a = Get-VMHost -Name HostName | get-vm | Where {$_.PowerState -eq "PoweredOn"} | select NumCpu; $a.count
How to get summary of VM snapshot size
$vms = get-vm; foreach ($vm in $vms) {$snap = get-vm -Name $vm.Name | Get-Snapshot | Measure-Object -Property SizeGB -Sum | Select Name -ExpandProperty Sum; if ($snap -gt 0) {$vm.Name, $snap}}
Get Canonical Name and Capacity of all Raw Devices (RDM) attached to each VM in the cluster
foreach ($v in $(get-cluster -Name Cluster Name | Get-VM)) {$v.Name; Get-VM -Name $v.Name | Get-HardDisk -DiskType RawPhysical | select ScsiCanonicalName,CapacityGB}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment