' Eject all CD/DVD drives
Eject "F:\\"
Sub Eject(CDROM)
Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
Set WshShell = CreateObject("WScript.Shell")
' Mount an image
strRun = "ImageMount.exe /Q /M c:\image.iso"
' Run the mount application
call WshShell.run(strRun)
Find out which letter the CD Rom drive is on
Const DriveTypeCDROM = 4
Set oFS = Wscript.CreateObject("Scripting.FileSystemObject")
Set oDrives = oFS.Drives 'Loop thru A-Z. If found, exit early
For Each Drive in oDrives
If Drive.DriveType = DriveTypeCDROM Then
Wscript.Echo Drive.DriveLetter
End If
Next
Find out the CD/DVD drive information
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
For Each objItem in colItems
strmsg=""
strmsg=strmsg&"Description: " & objItem.Description&vbcrlf
strmsg=strmsg&"Drive: " & objItem.Drive&vbcrlf
strmsg=strmsg&"Manufacturer: " & objItem.Manufacturer&vbcrlf
strmsg=strmsg&"Media Loaded: " & objItem.MediaLoaded&vbcrlf
wscript.echo strmsg
Next