I have a script to create linked clones (credit goes to members of this forum for helping me get it right) but i'm having issues with the customization as the script tries to apply the customization before the clone has completed and i get the following:
Script:
The error:
Set-VM : 1/25/2012 5:13:24 PM Set-VM The object has already been dele
ted or has not been completely created
At C:\Users\lpalacio\Documents\Scripts\VMware PowerCLI\Create-Linked-Ask.ps1:21
char:12
+ Set-VM <<<< "$strVMNAME$i" -OSCustomizationSpec "CTX-Customization" -co
nfirm:$false
+ CategoryInfo : NotSpecified: (:) [Set-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.SetVM
You can try to wait till the is finished as follows
...
$taskMoRef = $sourceVM.CloneVM_Task( $cloneFolder, $cloneName, $cloneSpec )
$task = Get-View $taskMoRef
while("running","queued" -contains $task.Info.State){
$task.UpdateViewData("Info")
sleep 5
}
....
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can try to wait till the is finished as follows
...
$taskMoRef = $sourceVM.CloneVM_Task( $cloneFolder, $cloneName, $cloneSpec )
$task = Get-View $taskMoRef
while("running","queued" -contains $task.Info.State){
$task.UpdateViewData("Info")
sleep 5
}
....
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Thank you that worked perfectly.
and in case anyone wants the final product here it is: