Windows Vista Forums

Eject a Zip Disk

  1. #1


    Mesan Guest

    Eject a Zip Disk

    I've been searching for a long time for a way to eject a zip disk from
    within a powershell script but haven't been able to find anything.

    I finally came across the Removable Storage Manager (rsm.exe) utility
    and found a way to make it work.

    This is what it takes on my machine with just a single internal IDE
    Zip-100, so you may have to modify things a bit, but this at least
    gives you the framework of what to do.

    I'm very much open to suggestions for how this can be improved, it's a
    very crude approach I'm sure.

    __________________________________________________________________________

    # Refresh removable storage
    # NOTE: That's MY guid - yours is probably different, so run "rsm
    view /tmedia_type /guiddisplay" and find your guid for "Removable
    Media"
    rsm refresh /tgf5ed678de1c342c1a6833f0cc16b700c

    # Get the friendly name of the zip disk
    rsm view /tphysical_media /b > out.txt
    $friendly_name = get-content out.txt
    # At least on my computer the output was 2 lines - a blank line
    followed by the friendly name that I wanted
    $friendly_name = $friendly_name[1]

    # Eject the zip disk
    rsm eject /pf"$friendly_name"


      My System SpecsSystem Spec

  2. #2


    dreeschkind Guest

    RE: Eject a Zip Disk

    Hi Mesan, thanks for sharing this. I think I can use this for my iPod. :-)
    I modyfied your code a little bit so that the script selects the right guid
    based on the media type name that you specify. Note that the name needs to be
    localized. For example on my German WinXP 'Removable Media' is called
    'Wechselmedien'.
    I also removed the use of the temporary file. You can redirect the standard
    output directly to a variable instead.

    ####################################
    $guid = rsm view /tmedia_type /guiddisplay | select-string 'Removable Media'
    | foreach { $_.line.substring($_.line.length-32, 32) }

    rsm refresh /tg$guid

    $friendly_name = rsm view /tphysical_media /b | select-string 'DREESCHPOD' |
    foreach {$_.line}

    rsm eject /pf$friendly_name
    ####################################

    --
    greetings
    dreeschkind

    "Mesan" wrote:

    > I've been searching for a long time for a way to eject a zip disk from
    > within a powershell script but haven't been able to find anything.
    >
    > I finally came across the Removable Storage Manager (rsm.exe) utility
    > and found a way to make it work.
    >
    > This is what it takes on my machine with just a single internal IDE
    > Zip-100, so you may have to modify things a bit, but this at least
    > gives you the framework of what to do.
    >
    > I'm very much open to suggestions for how this can be improved, it's a
    > very crude approach I'm sure.
    >
    > __________________________________________________________________________
    >
    > # Refresh removable storage
    > # NOTE: That's MY guid - yours is probably different, so run "rsm
    > view /tmedia_type /guiddisplay" and find your guid for "Removable
    > Media"
    > rsm refresh /tgf5ed678de1c342c1a6833f0cc16b700c
    >
    > # Get the friendly name of the zip disk
    > rsm view /tphysical_media /b > out.txt
    > $friendly_name = get-content out.txt
    > # At least on my computer the output was 2 lines - a blank line
    > followed by the friendly name that I wanted
    > $friendly_name = $friendly_name[1]
    >
    > # Eject the zip disk
    > rsm eject /pf"$friendly_name"
    >
    >


      My System SpecsSystem Spec

Eject a Zip Disk

Similar Threads
Thread Forum
CD-ROM disk drive not opening, LED eject button light not on
Hi, I have been unable to open the CD-ROM disk drive. The LED eject button light doesn't turn on either. I have a Dell LATITUDE E5500. I would...
Drivers
E Disk Eject Error
Help my friend with this?: Here's the problem: my disc drive won't eject. D: And its a slot drive so it doesn't have one of those little holes on...
Drivers
cd-rom eject
I'm tired of accidentally clicking on an empty CD / DVD drive and having it eject the tray on me. Does anyone know of a way to stop this behavior...
General Discussion
Re: CD will not eject
"Jennifer" <Jennifer@xxxxxx> wrote in message news:D06CDC17-E364-4D60-A046-A04C6D5C0918@xxxxxx Have you contacted Gateway tech support? ...
.NET General
CD won't eject !!!!!!!!!!
I've pushed the button, won't open!!!! I've looked around in programs, yet can't find another way to open it......??? Is there one?? I...
Vista General
Windows Explorer closes itself on cd/dvd disk eject
When I'm viewing a CD/DVD disk and then eject the disk tray, how do I stop Vista's Windows Explorer from closing itself? This didn't happen in XP,...
Vista General
how can i eject my cd-rom
is it possible to eject my cd when my program finishes?
PowerShell