I don't quite recall how I did it but I have a similar story of ejecting disc trays across my HS and school district. something with novell iirc
We also built a program that would monitor a file on a network drive and run new commands when added to it so we could eject the CD and/or show a message on demand.
Only did this within our club that made the school yearbook which had three computers over two rooms in its own lab so we didn't do anything too dangerous.