VMware Cloud Community
xingjian
Contributor
Contributor

OSCustomizationSpec seems not applied when cloning Windows from an exsisting VM

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

0 Kudos
7 Replies
LucD
Leadership
Leadership

Anything in the customisation (see folder C:\Windows\Temp/vmware-imc) and/or sysprep logs (see KB2001932?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
xingjian
Contributor
Contributor

Hi,LucD

Thanks for reply.

I've check the folder  C:\Windows\Temp ,but there's no folder named vmware-imc .

I'll check the logs by following KB200192 on monday,hope to find some clues 

0 Kudos
xingjian
Contributor
Contributor

Hi,LucD

I checked the folder by following KB2001932.But there's noting at all.

Is there another way to check this out ?

0 Kudos
LucD
Leadership
Leadership

Have you already tried using the -Type Permanent parameter on the New-OSCustomizationSpec cmdlet?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
xingjian
Contributor
Contributor

No,I havn't.

You mean -Type Persistent/NonPersistent?

I've tried not to delete the OSCustomizationSpec that created by script after the clone task,and i checked the detail about this OSCustomizationSpec on vSphere web client,it's looks good.

I also tried to create a OSCustomizationSpec by manual,and clone a windows VM using this OSCustomizationSpec,it's still not work.

So i think maybe it's noting to do with the PowerCLI,but i can't find any logs or the error messages to solve this problem.

0 Kudos
LucD
Leadership
Leadership

Yes, I mean Persistent.

Since it doesn't seem to work from the Web GUI it looks indeed as if it is not a PowerCLI issue.

Just to make sure, you do have a vCenter license?
That is required for OS Customization.

Worst case, you can open an SR


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
xingjian
Contributor
Contributor

OK,thanks for help.

I do have the vCenter license.

As i metioned.Everyting works fine on Linux VMs.

Maybe i should open an SR like you said.

Thanks again !

0 Kudos