Hi All,
After taking bits of code from here and other (LucD + Mr Epping amongst many others - cheers!) I'm nearly done with a script to deploy a template with 3 NICs and addresses, masks and GW from a CSV.
Everything seems to work nicely, but I keep getting the error 'Fault.NicSettingMismatch.summary' when the customization of a the temporary non persistent spec takes place.
The code is here
Original custom spec is got here:
Get-OSCustomizationSpec -Name $Spec | New-OSCustomizationSpec -Name TempSp -Type NonPersistent
The we work on a nonpersistent copy to make the amendments to the IP, Mask and GW:
# Setup the IP addresses
$osCust = Get-OSCustomizationSpec -Name TempSp -Type NonPersistent
$osCust | Get-OSCustomizationNicMapping | where {$_.Position -eq 1} |
Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $vm.IP1 -SubnetMask $vm.MASK1 -DefaultGateway $vm.GW1
$osCust | Get-OSCustomizationNicMapping | where {$_.Position -eq 2} |
Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $vm.IP2 -SubnetMask $vm.MASK2 -DefaultGateway $vm.GW2
$osCust | Get-OSCustomizationNicMapping | where {$_.Position -eq 3} |
Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $vm.IP3 -SubnetMask $vm.MASK3 -DefaultGateway $vm.GW3
.. where the $vm.XXX are being pulled from a CSV in the loop to create each VM .. followed by
New-VM -Name $vm.Name -OSCustomizationSpec $osCust -Template $Template -VMHost $NewHost -Datastore $NewDatastore
to do the clone from template.
I get output that suggests the customisation is OK .... i.e. right IPs in the right positions but still it fails.
The template deploys with 3 NICs on the right portgroups, and when I boot it manually it has not received any customisation at all (name not changed etc.)
Any ideas? I can put the full script up if it helps. Guest is RHEL 6.
All help gratefully received :-)