Hi,
I've been using the excellent script from http://blog.smasterson.com/2014/05/21/deploying-multiple-vms-via-powercli-updated-v1-2/ successfully for a while now.
Recently though it started throwing errors:
Set-OSCustomizationNicMapping : 12/11/2015 10:12:21 Set-OSCustomizationNicMapping
Required property ip is missing from data object of type CustomizationIPSettings
while parsing serialized DataObject of type vim.vm.customization.IPSettings
...
At C:\PSH-Scripts\VMWare\DeployFromCSV2\DeployVM.ps1:346 char:54
+ $tempSpec | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMappi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-OSCustomizationNicMapping], InvalidRequest
+ FullyQualifiedErrorId : Client20_VMGuestServiceImpl_ModifyServersideSpec_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetOSCustomizationNicMapping
The offending code:
$spec = Get-OSCustomizationSpec -Name $VM.CustSpec
$tempSpec = $spec | New-OSCustomizationSpec -Name temp$vmName
$tempSpec | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping `
-IpMode UseStaticIP -IpAddress $VM.IPAddress -SubnetMask $VM.SubnetMask `
-Dns $VM.pDNS,$VM.sDNS -DefaultGateway $VM.Gateway | Out-Null
All the $VM properties are present and correct. The only thing I can think of is we recently upgraded to 5.5 from 5.1 but I can't find anything deprecated etc
I've been running into this issue as well. I've found several scripts online for deploying multiple VMs but everyone of them seems to not work for setting the IP and has a similar error.
running 5.5 vCenter and hosts and this script Deploying multiple VMs via PowerCLI – Updated v1.2 | Shawn Masterson's Blog
11/19/2015 4:19:34 PM Set-OSCustomizationNicMapping
Required property ip is missing from data object of type CustomizationIPSettings
while parsing serialized DataObject of type vim.vm.customization.IPSettings
at line 1, column 1637
while parsing property "adapter" of static type CustomizationIPSettings
while parsing serialized DataObject of type vim.vm.customization.AdapterMapping
at line 1, column 1622
while parsing property "nicSettingMap" of static type ArrayOfCustomizationAdapterMapping
while parsing serialized DataObject of type vim.vm.customization.Specification
at line 1, column 570
while parsing property "spec" of static type CustomizationSpec
while parsing serialized DataObject of type vim.CustomizationSpecItem
at line 1, column 335
while parsing call information for method OverwriteCustomizationSpec
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method overwrite
on object of type vim.CustomizationSpecManager
at line 1, column 0
Which PowerCLI version (do a Get-PowerCLIVersion) are both of you running ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So I figured out that the script does not work using PowerCLI 6.0, when I went back to a system running PowerCLI 5.5 Release 2 Patch 1 build 1931983, the script ran fine.
On a side note, someone has created a newer version of this script that allows deploying more them one VM at a time instead of waiting for the first to finish. The only issue is I do not see a way to limit the concurrent amount of VMs being deployed at a time. I learned that lesson after 50 kicked off from a single template source.
https://github.com/Vidanez/DeployVMs