Remotely Eject a CD 
Author Message
 Remotely Eject a CD

sorry for the x-post...

I need to remotely eject a CD but WMI does not support an eject method. Is
there a mechanism for this? (code would be much appreciated....)

Neil



Mon, 29 Aug 2005 00:49:39 GMT  
 Remotely Eject a CD
Hi,

This works locally, not sure about remotely:

---
sDrive= "X" 'determine letter by drive type if need be

Set oMyCptr = CreateObject("Shell.Application").NameSpace(17)
oMyCptr.ParseName(sDrive & ":\").InvokeVerb("e&ject")
---

Joe Earnest


| sorry for the x-post...
|
| I need to remotely eject a CD but WMI does not support an eject method. Is
| there a mechanism for this? (code would be much appreciated....)
|
| Neil
|
|

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 10-31-02



Mon, 29 Aug 2005 01:30:31 GMT  
 Remotely Eject a CD

: sorry for the x-post...
:
: I need to remotely eject a CD but WMI does not support an eject method. Is
: there a mechanism for this? (code would be much appreciated....)
:

Someone posted this a while ago (can't remember who) - seems to work OK locally

Dim winMedia, cdRoms, i

Set winMedia = CreateObject("WMPlayer.OCX.7")
Set cdRoms = winMedia.cdromCollection

If cdRoms.Count > 0 Then
 For i = 0 to cdRoms.Count - 1
  cdRoms.Item(i).Eject
 Next
End If

Set winMedia = Nothing
Set cdRoms = Nothing



Mon, 29 Aug 2005 05:55:02 GMT  
 Remotely Eject a CD

Quote:

> I need to remotely eject a CD but WMI does not support an eject method. Is
> there a mechanism for this? (code would be much appreciated....)

Hi

You could try to combine wizmo.exe (eject CD) with psexec.exe (for the remote
part). Psexec.exe can also automatically copy Wizmo.exe over to the remote
computer if you want (or you can pre-copy it yourself to reduce launch time).
Both utilities are free.

More details about psexec.exe here:

From: Torgeir Bakken (MVP)
Subject: Re: Automating MS update installs
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-04 17:44:03 PST
http://groups.google.com/groups?selm=3D9E348C.E51CF526%40hydro.com

Wizmo
http://grc.com/wizmo/wizmo.htm

From the docs:

DRIVE OPEN (EJECT) and CLOSE (LOAD)

 open   opens the system's default CDROM drive tray.
Example: wizmo open

 close   closes the system's default CDROM drive tray.
Example: wizmo close

 open={drive:}   open or eject specific removable drive media.
On systems with multiple CDROM or other removable drives (e.g. Iomega Zip and
Jaz) this opens or ejects the media from the specified drive.
Example: wizmo open=w:

 close={drive:}   close or load specific removable drive media.
(NT/2000/XP only) On systems with multiple CDROM or other removable drives
(e.g.

Iomega Zip and Jaz) this closes or loads the media on the specified drive. This

function is not available under Windows 95/98/ME. On those systems it will
behave like the "close" function above.
Example: wizmo close=r:

Anoter open/close CD utility:

Open/Close CD v1.20
http://www.rjlsoftware.com/software/utility/open_cd/

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Mon, 29 Aug 2005 06:08:40 GMT  
 Remotely Eject a CD

Quote:
> sDrive= "X" 'determine letter by drive type if need be

> Set oMyCptr = CreateObject("Shell.Application").NameSpace(17)
> oMyCptr.ParseName(sDrive & ":\").InvokeVerb("e&ject")

Nice!  Where'd you come across this little tidbit?  The .NameSpace(17) thing
I mean.


Mon, 29 Aug 2005 12:14:44 GMT  
 Remotely Eject a CD
Hi Curtis,



| > sDrive= "X" 'determine letter by drive type if need be
| >
| > Set oMyCptr = CreateObject("Shell.Application").NameSpace(17)
| > oMyCptr.ParseName(sDrive & ":\").InvokeVerb("e&ject")
|
| Nice!  Where'd you come across this little tidbit?  The .NameSpace(17)
thing
| I mean.

Well it's definitely not mine.  (I'm not that clever.)  hmm ...  I have the
original text stuck in a older text file where I used to stick short lines
of code that I copied from newsgroup posts.  Unfortunately, I don't have it
attributed.  I believe (vaguely recall? or misrecall?) that it's a Walter
Zachery concoction that I found through Google, but I'm far from sure about
that and may be misattributing it.  I remember that I found it after I had
spent some time working it out myself, but much less elegantly, and I liked
it far better than my solution.  I was testing for drive verbs in parallel
with file verbs using ShellExecute, and came up with (per the code next to
this in the text file):

Set oShellApp= CreateObject("Shell.Application")
sMyCptr= "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
sDrive= sMyCptr & "\B:\"
oShellApp.ShellExecute sDrive,,, "explore"

and

Set oShellApp= CreateObject("Shell.Application")
sMyCptr= "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
sDrive= sMyCptr & "\B:\"
oShellApp.ShellExecute sDrive,,, "eject"

I thought the InvokeVerb instead of the ShellExecute was the cat's meow. ;-)

The NameSpace makes sense, since the oShellApp special folder code for
MyComputer (Drives) is 17.  I assume that it could work for any of the
special folder numbers, but I've never tried it.

Regards,
Joe Earnest

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 10-31-02



Mon, 29 Aug 2005 13:12:38 GMT  
 Remotely Eject a CD

Quote:

> Hi Curtis,




> | > sDrive= "X" 'determine letter by drive type if need be
> | >
> | > Set oMyCptr = CreateObject("Shell.Application").NameSpace(17)
> | > oMyCptr.ParseName(sDrive & ":\").InvokeVerb("e&ject")
> |
> | Nice!  Where'd you come across this little tidbit?  The .NameSpace(17)
> thing
> | I mean.

The technique has been circulated in the scripting groups for quite a while.

http://groups.google.com/groups?q=CreateObject("Shell.Application").NameSpace(17)%20group:*.scripting&num=100&scoring=d

-Paul Randall



Mon, 29 Aug 2005 23:01:32 GMT  
 Remotely Eject a CD

http://groups.google.com/groups?q=CreateObject("Shell.Application").NameSpac
e(17)%20group:*.scripting&num=100&scoring=d
Coolness.  Thanks - I'm finding all sort of little tidbits from this search.


Tue, 30 Aug 2005 01:17:16 GMT  
 Remotely Eject a CD

Quote:
> I thought the InvokeVerb instead of the ShellExecute was the cat's
> meow. ;-)

Yes, I recall a Michael Harris script to disable NICs via script that uses
sort of the same method. He used oDisableVerb.DoIt and oEnableVerb.DoIt  -
very neat technique.  I've *got* to learn more about this stuff. :-)


Tue, 30 Aug 2005 01:21:18 GMT  
 Remotely Eject a CD
Ok you guys have given me about 3 different ways to do this locally. Is
there a way to have this done remotely. I would like to have a tool where
shove in the computer name of one of the racks and it pops the drive tray
open so I know which is which. How can I run the script locally but have the
actions carried out remotely?


Quote:
> sorry for the x-post...

> I need to remotely eject a CD but WMI does not support an eject method. Is
> there a mechanism for this? (code would be much appreciated....)

> Neil



Tue, 30 Aug 2005 21:53:56 GMT  
 Remotely Eject a CD

Quote:

> Ok you guys have given me about 3 different ways to do this locally. Is
> there a way to have this done remotely. I would like to have a tool where
> shove in the computer name of one of the racks and it pops the drive tray
> open so I know which is which. How can I run the script locally but have the
> actions carried out remotely?

Hi

My Psexec.exe/Wizmo.exe suggestion was for remote execution.

The other methods mentioned should also possibly be executed remote by using the
WshRemote Object:
http://msdn.microsoft.com/library/en-us/script56/html/wslrfremote_wsh...

To make WshRemote work, there are some settings that needs to be in place:


Subject: Re: I can't get remote scripting to work with WSH 5.6. Help!
Newsgroups: microsoft.public.scripting.VBScript
http://groups.google.com/groups?selm=eBGZNLE5CHA.2312%40TK2MSFTNGP10....

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Tue, 30 Aug 2005 22:55:10 GMT  
 Remotely Eject a CD
Thanks Torgeir;
    I tried the psexec but would not work on 2000AS sp3. I will give the
others a try....

Neil



Quote:

> > Ok you guys have given me about 3 different ways to do this locally. Is
> > there a way to have this done remotely. I would like to have a tool
where
> > shove in the computer name of one of the racks and it pops the drive
tray
> > open so I know which is which. How can I run the script locally but have
the
> > actions carried out remotely?

> Hi

> My Psexec.exe/Wizmo.exe suggestion was for remote execution.

> The other methods mentioned should also possibly be executed remote by
using the
> WshRemote Object:

http://msdn.microsoft.com/library/en-us/script56/html/wslrfremote_wsh....
asp
Quote:

> To make WshRemote work, there are some settings that needs to be in place:


> Subject: Re: I can't get remote scripting to work with WSH 5.6. Help!
> Newsgroups: microsoft.public.scripting.vbscript

http://groups.google.com/groups?selm=eBGZNLE5CHA.2312%40TK2MSFTNGP10....

- Show quoted text -

Quote:

> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Wed, 31 Aug 2005 00:07:40 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Eject CD in case of 2 CD drives

2. EJECT CD from CD Drive ???

3. How to eject a Cd when are multiple CDs

4. Ejecting CD's

5. Eject my cd drive ?

6. Eject my cd drive

7. Eject CD-ROM

8. ejecting CD-Rom with VBScript?

9. Eject CD

10. eject command for CD Player

11. Newbie question : Ejecting a CD-Rom

12. Quick script to EJECT a CD.

 

 
Powered by phpBB® Forum Software