I'm using a PowerCLI script to cloning VM.Everyting goes well on Linux VMs. But when i change the code that part of the OSCustomizationSpec to clone the Windows VMs.These's no error message and the clone task can be done.But the OSCustomizationSpec not applied to the new Windows VM.
Here's the code:
$osspec = New-OSCustomizationSpec -Name $specName -OSType Windows -FullName Administrator -OrgName $Orgnization -WorkGroup WORKGROUP -ChangeSid:$True -TimeZone 210 -AdminPassword xxxxx
$osspec | Set-OSCustomizationSpec -NamingScheme Fixed -NamingPrefix $hostname
$osspec | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $primary_ip -SubnetMask $vm_netmask -DefaultGateway $vm_gateway -Dns $vm_dns
New-VM -VM $src_vm -Name $vm_name -OSCustomizationspec $osspec -ResourcePool $vmCluster -Datastore $vmDatastore