VMware Cloud Community
brassneck
Contributor
Contributor

Issues with Set-OSCustomizationNicMapping

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 🙂

0 Kudos
4 Replies
brassneck
Contributor
Contributor

Quick update. Applying the Customisation spec directly to the template seems to work as intended, so the problem is occurring when I copy it up to

a non persistent spec to edit the NIC parameters. I got this from these forums so hopefully it might narrow it down a bit.

0 Kudos
LucD
Leadership
Leadership

You might want to have a look in the vpxd log on your vCenter, normally that log shows some extra information when there is a fault.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

brassneck
Contributor
Contributor

Thanks Luc - sorted it in the end. I had an extra line at the top of the script that effectively meant I was copying the spec into the temp spec twice .. for some reason this equated to a temp spec that was blank. Anyway, once this was sorted I was deploying 100 VMs in about 1/2 an hour ... got to love PowerCLI 🙂

0 Kudos
LucD
Leadership
Leadership

Indeed Smiley Happy

Glad you found the source of the problem


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos