VMware Cloud Community
Matt_B1
Enthusiast
Enthusiast

Set-CDDrive hangs with "override the lock" question

I have a script to unmount the CD-ROM/ISO for a list of VMs.  It works well but will hang for VMs that get a question about "override the lock" to disconnect it.  I can answer this Set-VMQuestion but since the script is hung up on the Set-CDDrive command, I am stuck.  How can I get past this issue?  This is the command I am using the unmount the ISO.

Set-CDDrive -CD $cd -NoMedia -Confirm:$false

0 Kudos
1 Reply
LucD
Leadership
Leadership

The only solution I can think of right now, is to check inside the guest OS (Invoke-VMScript or Get-WmiObject) if there is a CD/DVD mounted, and if it is unmount it.

The disadvantage is that this requires VMware Tools on all VMs (which you should have in any case :smileygrin:) and that the guest OS is supported by Invoke-VMScript.


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

0 Kudos