remotely eject a list of cd drives

hi there

i find that sometimes i have to have a datacenter employee go reboot a server... and he can't tell which one i want.

i'd like to be able to run a batch file from the domain controller, to eject all the cd drives of a list of servers except whichever one i comment out

i can address the servers by netbios name, like, \\server01

what's the easiest way to get them all ejected?

yes i could just go there and put stickers on them, but that would be too - analog... i would like a more digital solution than something as archaic as paper stickers :)
LVL 24
B HAsked:
Who is Participating?
 
slemmesmiCommented:
Dear bryon44035v3,

if you have VBscript enabled on your servers, you can use the following (from http://www.tomshardware.co.uk/forum/154492-35-small-script-batch-file-open-drive-door):

*begin*
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection

if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
End If

Set oWMP = Nothing
Set colCDROMs = Nothing
*end*

Save this as a script (e.g. OpenCD.vbs) on each server.
Now you can use PSTools to remote execute.

P.S. AntiVirus on the servers may however detect the script as contains the "Joke-EjectCD Joke". Hence you may want to exclude that.

Kind regards,
Soren
0
 
B HAuthor Commented:
so i guess if i save that as a file.vbs, i would run something like:
psexec \\server c:\file.vbs
?

0
 
slemmesmiCommented:
Dear bryon44035v3,

just come to think of it - you obviously when want to do the above must consider:

1. What if a server is using the CD drive when I want to (from remote) open it's CD drive?
2. Is there free space to open the CD drive of all servers (e.g. if a server is in a rack and the front door is closed)?

I'd recommend the "analog" solution anytime/anyway - label each server.

Kind regards,
Soren
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
slemmesmiCommented:
Dear bryon44035v3,

yes to your question about psexec.

Kind regards,
Soren
0
 
B HAuthor Commented:
i wonder if i stick the vbs file in a shared folder, can i psexec the other machines to execute it?
0
 
B HAuthor Commented:
the servers are all 1u in size, and as such have the mini cd tray like laptops, so they only eject about an inch

one of these days i'll make the drive out there to label them - one last adjustment to the question:

what's the psexec format to call a list of netbios names without waiting for each one to finish (something about @list and /d)
0
 
B HAuthor Commented:
this is perfect, thanks
0
 
slemmesmiCommented:
Yes you can use the @file, or eventually psexec [\\computer[,computer2[,...]

The "-d" moves forward without awaiting returncode.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.