Tech: Automating VMware Virtual CDROM and floppy disconnection

Gabrie van Zanten posted on VMTN Forums a Bash script for disconnecting resources-consuming virtual CDROM and floppy devices:

I found that project admins who install VM’s often forget to disconnect CD-rom or floppy drives after they have been used. And because according to the VMware docu, CD-rom and floppy drives use extra resources through the COS, I started looking for a script that could disconnect all CD-roms and floppy at night.

Through the VMware community forum I received a script from Stuart Thompson which I editted for personal use. The result is below.