$cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
$cloneSpec.Customization = Get-OSCustomizationSpec -Name "Windows Server Default"
results in:
Exception setting "Customization": "Cannot convert the "Windows Server Default" value of type "VMware.VimAutomation.ViCore.Impl.V1.OSCustomization.OSCustomizationSpecImpl" to type "VMware.Vim.CustomizationSpec"."
Anyone know how can I convert between the types?
Regards,
Ryan
You can't assign a .Net object to a property that expects a server-side object.
You can do this
$cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
$cloneSpec.Customization = (Get-OSCustomizationSpec -Name "Windows Server Default").ExtensionData.Spec
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can't assign a .Net object to a property that expects a server-side object.
You can do this
$cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
$cloneSpec.Customization = (Get-OSCustomizationSpec -Name "Windows Server Default").ExtensionData.Spec
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD!
And in return here is the fruits of my labour. http://ninet.org/2011/11/clone-vmfromsnapshot/ It is a script to create a clone from a specific snapshot.
Regards,
Ryan