vmware

vmware powercli commands

Add Network Port Group

To add to all hosts in the cluster, use this script:

get-cluster "My-Servers" | Get-VMHost | Get-VirtualSwitch -Name "vSwitch0" | New-VirtualPortGroup -Name "VM Mgmt Network VLAN 101" -VLanId 101

To add to one host, use this script:

get-vmhost "IP of Host" | Get-VirtualSwitch -Name "vSwitch0" | New-VirtualPortGroup -Name "VM Mgmt...Read More »


VMware Scripts

PowerCLI get list of vMotion IP’s in use



$Array = @()
$Clusters = Get-Cluster | Sort Name
ForEach ($Cluster in $Clusters){
$VmHosts = $Cluster | Get-VmHost | Where {$_.ConnectionState -eq “Connected”} | Sort Name
ForEach ($VmHost in $VmHosts){
$Array += Get-VMHostNetworkAdapter -VMHost $VmHost.Name -VMKernel | Where {$_.VMotionEnabled -eq “True”} | select VmHost,IP
}
}
$Array | Out-GridView

 

Source: http://blog.jgriffiths.org/powercli-get-list-of-vmotion-ips-in-use/

Read More »

Script based vmware "DRS" (Distributed Resource Scheduler)

Recently I found a very interesting script to do something like vmware DRS.

https://ryanmangansitblog.com/2013/03/08/vmware-host-cluster-vm-memory-balancing-script-implementation/

There are some points to improve and the you can use it very well.


Use it only on a certain cluster

change the line 5 from

before
$objHosts = get-vmhost;