Hello
I'm trying to write a script for a VM deployment from a Template.
In my Template I have 3 NICs, with only one is configured with Static IP.
My script looks like:
########### # Template # ########### $template = Get-SCVMTemplate -All | where { $_.Name -eq $TemplateName } $virtualMachineConfiguration = New-SCVMConfiguration -VMTemplate $template -Name $VMName # Configure network Hardware $AllNICConfigurations = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration $virtualMachineConfiguration $NICConfiguration = $AllNICConfigurations[0] Set-SCVirtualNetworkAdapterConfiguration -VirtualNetworkAdapterConfiguration $NICConfiguration -IPv4Address $IPSvc -PinIPv6AddressPool $false -PinMACAddressPool $false # Deploy Update-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration New-SCVirtualMachine -Name $VMName -VMConfiguration $virtualMachineConfiguration -Description "Script Generated" -BlockDynamicOptimization $false -JobGroup $JobGroupID -ReturnImmediately -StartAction "TurnOnVMIfRunningWhenVSStopped" -StopAction "SaveVM"
(it's only a part of the whole code)
However the New-SCVirtualMachine job failed sometime with
Error (10737) A static IPv4 address or IPv4 address pool is specified for a virtual network adapter that was configured for a dynamic IPv4 address. Recommended Action Do not specify an IPv4 address or IPv4 address pool using Set-SCVirtualNetworkAdapterConfiguration, or configure the virtual network adapter for a static IPv4 address.
This really mean that sometime the network card [0] is not the static one.... but I don't find any way to identify the different adapters from the Template in order to fetch the correct one.
Does someone have an idea?
Thanks
MCITP: Enterprise Messaging Administrator 2010 MCTS: Lync Server 2010, Configuring MCSE