

+ CategoryInfo : InvalidArgument: (Linux3:VirtualMachineImpl), InvalidArgument Set-VM : 1:59:01 PM Set-VM The OsCustomization object, that you're trying to apply, contains a different number of NIC customization settings than the VirtualMachine's network adapter count. This property represents a part of the Id of the object so this

Set-OSCustomizationNicMapping : 1:58:54 PM Set-OSCustomizationNicMapping The property Posiotion of the object has been changed. + CategoryInfo : InvalidArgument: (Linux2:VirtualMachineImpl), InvalidArgument Set-VM : 1:58:54 PM Set-VM The OsCustomization object, that you're trying to apply, contains a different number of NIC customization settings than the VirtualMachine's network adapter count. Set-OSCustomizationNicMapping : 1:58:48 PM Set-OSCustomizationNicMapping The property Posiotion of the object has been changed. + FullyQualifiedErrorId : Client20_VmHostServiceImpl_CustomizeVM_NetworkAdapterCountMismatch.Commands.SetVM + CategoryInfo : InvalidArgument: (Linux1:VirtualMachineImpl), InvalidArgument + Set-VM $vm.name -OSCustomizationSpec LinuxCus -Confirm:$Fal. Set-VM : 1:58:47 PM Set-VM The OsCustomization object, that you're trying to apply, contains a different number of NIC customization settings than the VirtualMachine's network adapter count. + FullyQualifiedErrorId : Client20_ObjectVersionService_VerifyIsCurrentVersion_ExpiredObject.Commands.SetOSCustomizationNicMapping + CategoryInfo : ResourceUnavailable: (:), VimException icMapping | Set-OSCustomizationNicMapping -Position 2 –IpMode UseStat. Please get object again and run the operation. Set-OSCustomizationNicMapping : 1:58:41 PM Set-OSCustomizationNicMapping The property Posiotion of the object has been changed. $nicMapping | Set-OSCustomizationNicMapping -Position 2 –IpMode UseStaticIP –IpAddress $vm.IP2 –SubnetMask “255.255.240.0” –DefaultGateway “10.100.0.1” $nicMapping | Set-OSCustomizationNicMapping -Position 1 –IpMode UseStaticIP –IpAddress $vm.IP –SubnetMask “255.255.255.0” –DefaultGateway “192.168.100.1” $OSSpec2 = New-OSCustomizationNicMapping –OSCustomizationSpec LinuxCustomization –IpMode UseStaticIP –IpAddress “10.100.0.2” –SubnetMask “255.255.240.0” –DefaultGateway “10.100.0.1” I had forgotten to paste the changes and errors: The miss spell must have been due to the copy paste from my VM to my physical.

I have been looking for and not able to find anything on deploying vm's with 2 nics and and setting the network details with PowerCLI
#Vmware vsphere 6.5 powercli code
I need to modify the above code to also configure the 2nd nic which is also static and a different network e.g. My issue is that this wont work on vm's that have two nic's. Get-OSCustomizationSpec -Name 'LinuxCus' -ErrorAction Stop | Remove-OSCustomizationSpec -Confirm:$false Set-VM $vm.name -OSCustomizationSpec LinuxCus -Confirm:$False $nicMapping | Set-OSCustomizationNicMapping –IpMode UseStaticIP –IpAddress $vm.IP –SubnetMask “255.255.255.0” –DefaultGateway “192.168.100.1” $nicMapping = Get-OSCustomizationNicMapping –OSCustomizationSpec LinuxCus New-VM -Name $vm.Name -ResourcePool $vm.Cluster -Template $vm.Template -RunAsync Write-Warning "Creating $($vm.Name) in $($vm.cluster)" $OSSpec = New-OSCustomizationSpec –Name LinuxCus –Domain local –DnsServer “192.168.100.1” –OSType Linux –Type NonPersistent $vms = Import-Csv -Path "C:\Scripts\DeployVMTest.csv" #Connect-VIServer -Server 192.168.100.1 -User xxxxxxxx -Password xxxxxxxxx Name,Cluster,Template,Customization,IP,SubnetMask,DefaultGatewayĪnd the working code for these with only one nic is the following: I am able to create the new vm's and change their IP, submask and gateway successfully. The template is off another vm that has only 1 nic. I am deploying several Linux vm's using PowerCli, OSCustomizationSpec, a template and a csv file.
