Apply the customization
specification to each virtual machine.
for ($i = 0; $i –lt $vmList.Count; $i++) {
# Acquire a new static IP from the list
$ip = $staticIpList[$i].IP
# The specification has a default NIC mapping – retrieve it and update it with the static IP
$nicMapping = Get-OSCustomizationNicMapping –OSCustomizationSpec $specClone
$nicMapping | Set-OSCustomizationNicMapping –IpMode UseStaticIP –IpAddress $ip –SubnetMask "255.255.252.0" –DefaultGateway "192.168.0.1"
# Apply the customization
Set-VM –VM $vmList[$i] –OSCustomizationSpec $specClone –Confirm:$false
}
|