HI I am using the below powercli script to create windows vms from template, but IP address is nt assigning to the windows VM automatically and getting the error mentioned in the screenshot, how to get rid of the error.
Import-Csv "C:\Users\sg0217865\Desktop\NewVMs.csv" -UseCulture | %{
Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_.ip -SubnetMask $_.subnet -DefaultGateway $_.gw
$vm=New-VM -Name $_.Name -Template $_.Template -Host $_.Host -Datastore $_.Datastore -Confirm:$false -RunAsync -OSCustomizationSpec $_.Customization
$folder=Get-DataCenter -Name "LTX01-G8" | Get-Folder -Name "LTX-Servers" | Get-Folder -Name "LTX Servers 0000 - 0299" | Get-Folder -Name "0200 - 0299" | Get-Folder -Name "Windows"
Get-VM -Name $_.Name | Move-VM -Destination $folder
}