Neither of these subroutines are mine. I use this script typically when I am in an unfamiliar server room, or when I am remotely working on a server with local assistance. I open the CD/DVD tray to make sure that I am on the right hardware.
There is a funny story about me powering off the wrong server….
‘==========================================================================
‘ NAME: OpenTray.vbs
‘ COMMENT:
‘
‘==========================================================================
On error resume next
‘WMPlayerOpen
fso_open
Sub WMPlayerOpen()
‘from http://www.openopen.org/old/ie/open-cd-ie.html
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 ‘ cdrom
Next
End If
End Sub
Sub FSO_Open()
‘Windows-Script windowsscript@groups.msn.com
Const CDROM = 4
For Each d in CreateObject(“Scripting.FileSystemObject”).Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & “:\”
End If
Next
End Sub
Sub Eject(CDROM)
‘part of fso_open
Dim ssfDrives
ssfDrives = 17
CreateObject(“Shell.Application”)_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb(“E&ject”)
End Sub