When I use the below PowerCLI script to deploy VMs from Template I am getting the below error.
Here is the Complete PowerCLI script:
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 | Set-OSCustomizationSpec -OSCustomizationSpec $_.Customization
}