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 problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
E Disk Eject Error Ushiio Drivers 0 23 Apr 2009
cd-rom eject ltwally General Discussion 0 05 Dec 2008
CD won't eject !!!!!!!!!! ttroy Vista General 3 21 Aug 2007
Windows Explorer closes itself on cd/dvd disk eject newmarcom Vista General 0 16 Aug 2007
how can i eject my cd-rom 9nevermind9 PowerShell 11 17 Nov 2006