Tuesday, April 28, 2015

Rapid VM deployment of 100s of VMs at once

If you are a consulting company and want to deploy some 50, 100 or even what the heck 1000s of VMs on a customer's location and you don't want to be spending tons of man hours to do the same then use this script to do it for you.

#Rapid VM Deployer
#Author : Gajendra D Ambi
#Type : Powercli
#platform : VMware
$DeployTemplate = Get-Template Win2k12template #replace the Win2k12template with your template's name
$datastore = Get-Datastore Datastore01 #replace Datastore01 with the destination datastore on which the VMs should reside
#deploy vms from vmname-001 to 100
$VMNames = “VMname-{0:D3}”
$vms = @()
for ($i = 1; $i –le 100; $i++) {
$vm = $VMNames –f $i
$vms += New-VM -vmhost $host –Name $vm -Template $DeployTemplate -Datastore $datastore
of course you can have these VMs deployed with their respective static IPs, DNS, FQDN etc., pre configured using a csv file but more on that later. I only have time for this today

Monday, April 27, 2015

Downgrade VEM of cisco nexus 1000v

We have to sometimes downgrade or upgrade VEM vib packages on esxi hosts for the cisco n1k (1000v) and what we have noticed is that the damn thing won't let you do it. If it is a downgrade obviously you have to remove the old one and to do that you have to make sure that the related services aren't running.
#check vem status
vem status

#stop vem service if it is running
vem stop

#check vem status again to make sure it is not running
vem status

#kill that damn vem service if it is still running
#find the PID of the service
lsof | grep vem
#use the typical linux command to kill it using it's PID
kill -9 "vem PID"

#find the vem package which needs to be removed
esxcli software vib list | grep -i "vem"
esxcli software vib list | grep -i "cisco-vem"

#remove the vem vib package
esxcli software vib remove --vibname=cisco-vem-yyyy-esx

Thursday, April 23, 2015

Disk.UseDeviceReset one liner for your Esxi hosts

Another one liner to set the Disk.UseDeviceReset value on all the hosts of the vblock in case i do not remember.

Get-VMHost | Set-VMHostAdvancedConfiguration -Name Disk.UseDeviceReset -Value "0"

btw what is this damn Disk.UseDeviceReset ? and does it really need to be 0.

Disk.SchedQuantum (maximum number of consecutive “sequential” I/O’s per VM) one liner for Esxi

Another not so hard to remember one liner for my use when i need it.
what is Disk.SchedQuantum?
The maximum number of consecutive “sequential” I/O’s allowed from one VM before we force a switch to another VM (unless this is the only VM on the LUN). Disk.SchedQuantum is set to a default value of 8.
But how do we figure out if the next I/O is sequential or not? That's a good question.

get-vmhost | set-advancedconfiguration -name Disk.SchedQuantum -value "64"

The above will set the disk.schedquantum on all the hosts of the vcenter.

Set multiple syslog servers on multiple hosts

So I am just documenting this to make this comes in handy and my fish memory doesnt retain such good things..
how to update multiple syslog servers on all hosts of a datacenter.

get-vmhost | set-vmhostadvancedconfiguration -name syslog.global.loghost -value "zz.zz.zz.zz,yy.yy.yy.yy"
for a full updated version see it at github.
sharing is caring.
update 29/5/2015
now i have included all the advanced syslog settings in the github for the same. have fun. check out 2 types of the syslog script. one which use the legacy and deprecated method (which i loved it btw) and the new method.