VMware Cloud Community
Chuck8773
Hot Shot
Hot Shot

Set all VM's to Client Device for CD Drive

Does anyone know how to script the settings for the CD Drive on a VM? I have over 200 VM's that are connected to the volume that holds our ISO images. I would like to get all of them disconnected as I am changing the ISO volume.

Hoping there is a way through scripting to set all of those VM's to Client Device.

Thank you for your help.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Charles Killmer, VCP4 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
Reply
0 Kudos
3 Replies
mlubinski
Expert
Expert

you can use this software to remove mounted ISOs

http://www.robware.net/download/RVTools.pdf

[I]If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points[/I]
Reply
0 Kudos
Chuck8773
Hot Shot
Hot Shot

It looks like that can disconnect the ISO, but I want to remove that VM's connection to the LUN that holds the VM's. If you look at the map display on the LUN, it shows the VM's are connected even if the ISO is not mounted. Setting the VM to Client device removes this connection to the LUN.

RVTools is very nice though.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Charles Killmer, VCP4 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
Chuck8773
Hot Shot
Hot Shot

Thought I would post the Powershell script that I wrote to facilitate this.

Add-PSSnapin VMware.Vimautomation.Core

Connect-VIServer localhost

$vmlist = get-vm

for ($i=0;$i -lt $vmlist.count; $i++)

{

$cdtest = ""

$cdtest = get-cddrive $vmlist[$i] | findstr esxiso

if ($cdtest.length -gt 0)

{

get-cddrive $vmlist[$i] | set-cddrive -nomedia -confirm:$false

}

}

This will find all vms that have an iso mounted from the esxiso volume.

Use at your own risk. It worked in my environment, but should be tested by anyone that wants to use it.

Charles Killmer, VCP4

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Charles Killmer, VCP4 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
Reply
0 Kudos