You will get a error with that code you have a next but know For each. Here is the eject the Cd code WScript.Sleep 600 strComputer = "." On Error Resume Next Const Hidden = 0, Normal = 1, Min = 2 Const LogOff = 0, Shutdown = 1, Reboot = 2,PowerOff = 8 '''' FOR SHUT DOWN CODE Dim WMISrv, StrOS, ObjOS '''' FOR SHUT DOWN CODE Dim Act : Set Act = CreateObject("Wscript.Shell") Set oWMP = CreateObject("WMPlayer.OCX.7" ) Set colCDROMs = oWMP.cdromCollection colCDROMs.Item(i).eject Act.Run("%comspec% /c TASKKILL /F /T /IM Cscript.exe"),Hidden,True Act.Run("%comspec% /c TASKKILL /F /T /IM Wscript.exe"),Hidden,True Act.Run("%comspec% /c TASKKILL /F /T /IM Wmiprvse.exe"),Hidden,True WScript.Sleep 300 Here is the shut down code, you will need the lines I have pointed out in the above code for this one to work alone. Set WMISrv = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2") Set ObjOS = WMISrv.ExecQuery("Select * from Win32_OperatingSystem") For Each StrOS in ObjOS StrOS.Win32Shutdown(Shutdown) Next