During one of my current projects, I needed to create lots of virtual machines on a VMware vSphere 5 environment. These virtual machines were used as Citrix XenApp Worker servers provisioned by Citrix Provisioning Services (PVS). Therefore, we additionally needed to configure a static MAC address on each virtual machine.
For faster deployment and better documentation, I decided to do the word with the VMware Powershell interface called PowerCLI:
http://www.vmware.com/go/powercli
# -------------------------------------------------- # Connect to vCenter Server # -------------------------------------------------- connect-viserver –server "myVCenter.domain.local" # -------------------------------------------------- # Create new VMs from Template # -------------------------------------------------- New-VM -Name NewVM01 -Template W2K8R2_Datacenter_ENU -Datastore "SAN-Datastore-01" -VMHost "esx01.domain.local" New-VM -Name NewVM02 -Template W2K8R2_Datacenter_ENU -Datastore "SAN-Datastore-01" -VMHost "esx02.domain.local" # -------------------------------------------------- # Setting DRS Rules to separate NewVM01 and NEWVM02 # -------------------------------------------------- New-DrsRule -Name "Never on the same Host" -Cluster "Production" -Enabled $true -KeepTogether $false -VM "NewVM01", "NewVM02" # -------------------------------------------------- # Setting static MAC Addresses # -------------------------------------------------- Get-VM "NewVM01" | Get-NetworkAdapter | Set-NetworkAdapter -MacAddress "00:50:56:1A:00:01" -Confirm:$false Get-VM "NewVM02" | Get-NetworkAdapter | Set-NetworkAdapter -MacAddress "00:50:56:1A:00:02" -Confirm:$false