VMware Cloud Community
steveschofield
Enthusiast
Enthusiast

CD Attached / Floppy attached when using PowerCLI to create a linked clone

I have a script we are using to created linked clones.  Works great.  One of the things to fine tune our image we want the CD-ROM to be 😧 drive instead of E:  The master 'image' we have doesn't have a floppy or cdrom enabled.  Only after the image is copied do these things appear.  Do I have to handle adjusting this stuff 'after' the VM is created?  The CloneVM_Task doesn't appear to have additional properties to pass to handle things like this.

#Creates the VM

$sourceVM = Get-VM $ParentVMName | Get-View

$cloneFolder = $sourceVM.parent

$cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec

$cloneSpec.Snapshot = $sourceVM.Snapshot.CurrentSnapshot

$cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec

$cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]::createNewChildDiskBacking

$sourceVM.CloneVM_Task( $cloneFolder, $cloneName, $cloneSpec )

0 Kudos
1 Reply
LucD
Leadership
Leadership

That is correct, the assigning of a specific drive letter to the CD drive would have to be done inside the guest OS.

The Invoke-VMScript cmdlet can be used for that, but it requires the VMware Tools to be installed.

See for example Changing drive letter assignments after deploying a virtual machine from a template


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

0 Kudos