http://dieseyer.de • all rights reserved • © 2011 v11.4

'v3.7*****************************************************
' File: CDauswerfen.VBS
' Autor: dieseyer@gmx.de
' dieseyer.de
' Nach Info's von Thorsten Gudera, Christoph Basedau
'*********************************************************

Option Explicit

Dim WshShell, fso, ShellApp, DriveList, CDLw, Name, CDex
Dim i, Text

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

' shell32.dll version 4.71 or later
' http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/reference/objects/folder/copyhere.asp
' Betriebssystem ermitteln ( WinNT/2k/XP oder Win9x/ME )
Text = "\system32"
If not "Windows_NT" = WScript.CreateObject("WScript.Shell").Environment("Process")("OS") then Text = "\system"
Text = WSHShell.ExpandEnvironmentStrings("%WinDir%") & Text & "\shell32.dll"
Text = fso.GetFileVersion( text ) ' Versionsinfo (der Shell32.dll) holen
' wshshell.Popup "Die Shell32.dll hat die Version " & Text , 3, WScript.ScriptName
Text = Left ( CDbl ( text ), 3 ) ' Versionsinfo formatieren

If Text < 471 then
wshshell.Popup "Es ist ein Shell32.dll mit der Version 4.71 oder höher erforderlich." , 30, WScript.ScriptName & " - Ende"
WScript.Quit
End If

Set DriveList = fso.Drives
For Each i in DriveList

' if 0 = i.DriveType Then Text = "??? " & vbTab & i.DriveLetter & ": " & vbTab
' if 1 = i.DriveType Then Text = "Disk-Lw." & vbTab & i.DriveLetter & ": " & vbTab
' if 2 = i.DriveType Then Text = "Festpl. " & vbTab & i.DriveLetter & ": " & vbTab
' if 4 = i.DriveType Then Text = "CD-Lw. " & vbTab & i.DriveLetter & ": " & vbTab
' if 3 = i.DriveType Then Text = "Netz-Lw." & vbTab & i.DriveLetter & ": " & vbTab
' if 5 = i.DriveType Then Text = "RAM-Lw. " & vbTab & i.DriveLetter & ": " & vbTab

if 4 = i.DriveType Then
CDLw = i.DriveLetter & ":\"

' If i.IsReady Then

Set ShellApp=CreateObject("Shell.Application")
' MsgBox ShellApp.NameSpace(17)
Set Name = ShellApp.NameSpace(17)

' MsgBox Name.ParseName( "F:\" )
' MsgBox Name.ParseName( CDLw )
' Set CDex=Name.ParseName( "F:\" )
Set CDex=Name.ParseName( CDLw )

' CDex.InvokeVerb("Auto&Play") ' WinNT Server engl.
CDex.InvokeVerb("E&ject") ' WinNT Server engl.

CDex.InvokeVerb("Auswerfen")
' MsgBox "1"
CDex.InvokeVerb("&Auswerfen") ' Win2k Prof dt.
' MsgBox "2"
CDex.InvokeVerb("A&uswerfen")
' MsgBox "3"

' End If
End If
Next
MsgBox "Ende ", , WScript.ScriptName

http://dieseyer.de • all rights reserved • © 2011 v11.4