VMware {code} Community
angoletti1
Contributor
Contributor

How to disconnect CD-ROM from all VMs

Hi,

I'm using the VIPerlToolkit and trying to write a script, which disconnects the CD-ROM of all VMs.

I think it's just about a few line code, but I don't get it working.

Maybe Henry can help?

Reply
0 Kudos
7 Replies
esloof
Expert
Expert

Hi,

It's not written in Perl but it works.

http://www.ntpro.nl/software/VMCDConnected.7z

Regards,

Eric Sloof

http://www.ntpro.nl

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

Attached is a perl script (cdromdisconnect.pl) that searches a host for all connected host CD/DVDs and (optionally disconnects them).

cdromdisconnect.pl --op disconnect.

Comments are welcome. Full usage is included in the html file.

Henry

Reply
0 Kudos
angoletti1
Contributor
Contributor

Henry,

thank you very much.

I tried the script and got the following error message:

./cdromdisconnect.pl --host esx01 --op list

No session or username/password provided

Vim uninitialized at /usr/lib/perl5/site_perl/5.8.8/VMware/VIM2Runtime.pm line 132

Vim::get_service_content() called at ./cdromdisconnect.pl line 52[/i]

I think the login is not working right or maybe I did a mistake. In the script I didn't find something, where I can add a username or password.

I tried with a ESX-Server and VC.

Christoph

Reply
0 Kudos
bhoke
Enthusiast
Enthusiast

Try to add username and password as an argument like you did with host and op:

cdromdisconnect.pl --host esx01 --op list --username user --password password

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

Sorry, I forgot the standard login syntax:

cdromdisconnect.pl --host esx01 --op list --server name --username user --password password

If the server is VC, then the host argument is required.

If the server is an ESX host, then you don't need to specify the --host argument.

Hope this helps.

Reply
0 Kudos
rminick
Contributor
Contributor

404 on that link Smiley Sad

Richard J Minick, VCP
Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

I don't understand your message. You can't retrieve the sample script or you get a 404 when you try to run it?

Reply
0 Kudos