Auto Eject Flash drive at Logout

I work in a computer lab at my college and one of the common issues we have is people leaving their flash drives behind. I want to create a script/automation that will upon logout display a window reminding the user to remove their flash drive.
Any ideas as to what the best way to approach this is? (Automator/AppleScript/Etc.)
And where to begin?

how about this:
paste the following into Script Editor and save it as an application
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "Finder"
if number of disks > 6 then display dialog "please remove your flash drive"
end tell</pre>
Instead of 6 put the number of disks you normally have on that computer. save it as an application somewhere. then make a logout hook to run this app on logout.
to do that run the following terminal command
sudo defaults write com.apple.loginwindow LogoutHook /path/to/app/you/made
put the path you've just made in the above.

Similar Messages

  • Ibook not ejecting flash drive

    Hello all, I have a problem ejecting flash drives from my ibook g4 12" 1.33 ghz. Whenever there is one plugged in, the light on it is always on and when I try to eject it, it says that it is in use and that it cannot be ejected. I have Norton AV software on my ibook so I don't know if this will affect it. Please send me some suggestions. Thanks.

    In addition, some flashdrives have two components.
    My SanDisk has only one desktop icon, but my Memorex has two icons, for some reason.
    If a flashdrive mounts with two icons, draw a circle around both with the mouse to select both, and drag both to the trash.
    As noted, the lights mean little, and on some flashdrives, the light is on the underside and cannot easily be seen.
    I wait for a minute or so before removing the drive after ejecting it.

  • Auto eject TM drive

    Hi to all,
    I was wondering, is they a way to automatically eject a TM's drive during log out or shutting down? Maybe a command line using Terminal?
    Thanks
    Ric

    nerowolfe wrote:
    Richard_L wrote:
    Creating logout hook script?? Gosh... sorry I'm not a script or terminal guy...
    Anyone knows how to do the easier way to auto eject a TM drive or am I just being lazy..... =)
    You did ask for a terminal command.
    A script is merely several terminal commands, one after the other.
    Also why would you want to eject the TM drive during shutdown? It automatically gets ejected along with all the other drives during shutdown. You cannot properly shut a computer down without ejecting (dismounting) all HDs first.
    Yes, that's what I thought in the 1st place, but my iMac G5 just hangs there on a black screen & it won't shut down until I manually turn off the external drive's switch.
    But as soon as I manually dismount/eject the external drive before log out, my iMac shuts down without any problem.
    I wonder what's wrong with my iMac, further more if I turn my iMac & external drive ON at the same time, my TM drive hangs & won't do a backup. But if I do the other way round by turning on iMac 1st, then TM drive 2nd. Everything went ok again... I'm so lost with this problem...
    Any of you guys have this problem?
    cheers

  • Really Need To Eject Flash Drive Before Taking Out?

    Hi,
    On a PC, you can just pull a USB Flash Drive out of a USB port, without any problems. If you do this on a Mac, it warns you of data corruption, and suggests you eject it first. But, do you REALLY need to eject via software on a Mac? Isn't it just a precaution?

    I'm sorry we keep going back and forth on this. I don't know where you are getting this erroneous information from that "without a full eject first the drive may still be vulnerable."
    It's really very simple. By default, the OS tries to optimize performance by delaying any requests to write data to slow devices by pooling together multiple write operations into a cache and then performing all the write operations at once (flushing the cache) when the OS determines that it has some idle time to do so. When you eject or "Safely Remove..." the device, the OS forces a cache flush command, thus immediately performing any write operations it may have not done yet. When it is done emptying the cache it displays a message that it is now safe to disconnect the device.
    If you select the Fast Removal feature in the device manager, the write cache is disabled, so all data is written to the drive immediately and no cache flush is necessary. If you issue a "Safely Remove..." for a drive that has the Fast Removal option enabled, Windows simply ignores your request because there is no cache to flush. It simply skips the flush operation and immediately displays the message saying that it is now safe to disconnect the device.
    There is always the possibility for data loss (especially if you do something silly like yanking the drive out while it's being written to), but if you have the Fast Removal feature enabled, ejecting or doing a "Safely Remove..." does absolutely nothing magical that will make the drive less vulnerable. Of course, there is no harm done in ejecting a Fast Removal device because your request is ignored; but if the placebo effect makes you feel you are somehow less likely to have data loss, by all means go ahead and do it.
    Again, this is only for Windows. OS X does not have a Fast Removal option available from its GUI.

  • Trouble ejecting flash drives with Snow Leopard

    About every other time I try to eject my flash drive from my MacBook it freezes up the computer. My wife has the same problem on her computer. Is there anyone else that is having this problem and what can I do to fix it? Thanks!

    Try resetting some of the hardware involved (PRAM~NVRAM). See this Apple KB for details, etc.:
    http://support.apple.com/kb/HT1379
    Can't hurt to try, and apparently this has helped others recently.
    Also, try reformatting that flash drive using Disk Utility w/Snow Leopard...windows format only.

  • Ejecting Flash Drive

    I just purchased a SanDisk 4 GB Flash Drive which I hook up to my USB dock. I have been using a 2 GB SanDisk Flash Drive which seems to be operating differently than the 4 GB. I know you are not supposed to remove the flash drive when it is blinking because you may loose some of your data. My 4 GB does blink like the 2 GB. Is it OK to remove it when the light fades in and out? When I go to eject it by moving it to the trash, the light fades in and out. Do I have a defective flash drive? My 2 GB does not do this. I hope I have explained this right.

    In addition, some flashdrives have two components.
    My SanDisk has only one desktop icon, but my Memorex has two icons, for some reason.
    If a flashdrive mounts with two icons, draw a circle around both with the mouse to select both, and drag both to the trash.
    As noted, the lights mean little, and on some flashdrives, the light is on the underside and cannot easily be seen.
    I wait for a minute or so before removing the drive after ejecting it.

  • Auto Update Flash Drive

    Is there a way to automatically update certain files/folders on a usb drive each time it is connected?

    Hi atomic16
    In order to do an automatic update by simply plugging a usb drive in, your computer would need to be running a program or script which would recognize and perform the action whenever it saw the drive being plugged in. I don't know of any. I know it could be done, but I'm not a computer wizard?
    There are backup programs that you could schedule specific times to run a backup, but I don't think that's what you want. There are several ways to do full backups or just backing up specific files and folders. You could use Automator and build a backup script that would perform the actions, but you will need to start it yourself to do the backup. A better solution would be to use a program like Retrospect or SuperDuper to create a script to backup up the files. The advantage would be that you can do incremental backup instead of full backups which would be much faster and would only update the files that changed.
    This is not as covinent as just plugging in and watch it work, but a few simple keystrokes is not that much trouble.

  • HT5172 Glad to have USB capability on my new iMac.  Been in Mac world all of 2 days now.  Question - I downloaded photos from a Centron flash drive and am wondering if flash drives have to be ejected the same as on a PC?  Can't find how to do it.  Thanks.

    Been in the iMac world now all of 2 days.  I'm glad to have USB capability.  I downloaded photos from a Centron flash drive and now need to remove the flash drive.  Do you eject flash drives on iMacs as we did on PC's?  Can't find an answer in the support area.  Thanks...

    Yes. All external drives regardless of how they are connected must be ejected before they can be unplugged.

  • Tiger "quits" when eject ext flash drive???? Addressless addressbook

    Folks:
    Issues continue to crop up with Tiger, unlike those seen in Panther. A week back was finishing up working on a document which I saved to ext flash drive--closed the writing app, moved doc into flash drive, then ejected Flash drive by control/click and then maybe closed another app or turned off airport wireless &&& then got black window saying "You need to restart your computer." Then after restarted got an error window that said something like -- "You had to re-start your computer because OSX quit in the middle of what you were doing." OHHHH, the computer crashed!!!!??? I have ejected the Flash drive many times without this problem. Console crashreporter log showed single line entry for the time period that it happened--Thu Jun 21 17:41:44 2007 crashdump[94]: crashdump invoked as panicdump.
    Is this what 4.10 is supposed to fix???
    2). Needed my Addressbook to get email address of friend--opened the "ALL" part and there was only 15 or so addresses instead of what should have been 147 or so. Went to one of the smaller groups folders and all of the addresses were there??? How can there be more addresses in sub-category folder than in the total "All" folder?? Flipped back to the "All" folder after that just seconds later and lo and behold--all addresses were there??? This actually never went on with Panther frankly were stuff disappeared and the reappears seconds later--Is this an example of the SMART folder??? Will 4.10 fix this issue??
    eep

    Folks:
    Looking for some thoughts or ideas on why the entire system would "quit"--perhaps due to ejecting a flash drive? That seems more serious than an addressless addressbook, although when needing an address, one might hope to find it in Addressbook, right? In Panther applications would "quit" just because it felt like it--but not the whole system. Is this "normal" now, routine?
    eep
    iBook G4, 14, 933 MHz, Mac OS X (10.4.9) iMac G4, 15, 800MHz, (10.1.5)

  • Standard Mac users cannot eject Flash installer drive image

    We recently distributed Flash to 130 macs and it defaulted for auto update. Whenever it auto updates, it mounts a flash player drive image to the desktop. Unfortunately all the users are standard users and they cannot eject the mounted drive image without an administrator logon. I have wasted hours logging into each computer to manually eject these drives. How can I reverse this behavior?
    We are using apple remote desktop

    Hello,
    Since your users do not have Admin rights to install software, you'll want to disable auto-updates on each machine.  The update settings are stored in the /Library/Application Support/mms.cfg file.  You'll want to make sure the AutoUpdateDisable and SilentAutoUpdateEnable settings are configured as follows:
    AutoUpdateDisable=1
    SilentAutoUpdateEnable=0
    This will disable ALL updates for these machines, as such, you'll want to distribute updates via some other mechanism to ensure your users have the latest secure versions when they're released.
    Enterprise deployment information is documented in the Adobe Flash Player Administration Guide for Flash Player | Adobe Developer Connection.
    Maria

  • Flash Drive Won't Eject as a Whole

    My Computer (Windows 8) won't let me eject my flash drive in one piece.  It works fine on the other computers (Windows 7 & XP) in my house.  When I click "Safely Remove Hardware", three buttons appear:
    Cruzer Micro [faded & not clickable]
    >  - Eject Removable Disk (F:)
    >  - Eject Removable Disk (G:)
    When I eject both clickable links, the light on my flash drive doesn't turn off, but the "Safely Remove Hardware" link shows:
    ... [faded & not clickable]
    Any way of fixing this?  Thanks.
    P.S.
    I cant upload images of this without verification.

    P.S.
    I cant upload images of this without verification.
    To expedite this you can add a post to this verification thread.
    https://social.msdn.microsoft.com/Forums/en-US/009b33a8-c6af-4525-b27d-cc9ded6c39d4/verify-your-account-27?forum=reportabug
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • How do I eject the flash drive from an Officejet 8610 after scanning a file into it.

    I used the front panel controls of my Officejet 8610 to scan an image into a flash drive plugged into the front panel of the 8610.
    The 8610 recognized the presence of the drive just fine, and placed the scanned image on it as desired.
    But for the life of me, I cannot figure out how to do a controlled ejection of the flash drive.  (I finally did a controlled power-down of the 8610 and removed the drive after the 8610 turned itself off.)
    How do you do eject a flash drive from the front panel USB port?
    This question was solved.
    View Solution.

    @dcollins_mac
    Thank you for your post on the hp.com forums regarding safely ejecting your USB flash drive. In our printers, to remove your USB flash drive, all you need to do is - remove the flash drive. There is really no other method needed. You will not harm the flash drive, printer or files.
    Hope this helps.
    I am an HP employee.
    Say Thanks by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as Accepted Solution

  • Flash drive only "pretends" to eject - help!

    I am trying to transfer data from a Power Mac G5 running OS 10.3.9 to a 4 GB USB flash drive. After finishing the copying procedures, I attempt to eject the drive by dragging it to the trash bin, clicking the eject button within a finder window, or using the "eject" option from a pull-down menu, etc. The drive icon disappears from my desktop, but somehow it has not "finished" ejecting, for when I pull out the drive, I get the error message about not having ejected properly. I've tried this multiple times, even waiting for several hours for the ejection process to "finish," and each time have ended up with at least 1/2 my files on the flash drive being corrupted and useless.
    I have a large amount of data to transfer, since I'm trying to get it transferred from an old work/school computer to a personal computer at my new workplace. Thus, for efficiency's sake I cannot spend days/weeks transferring these data in smaller bits and it's not worth trying to go through the hundreds of different files to check each and every one to see if it's been corrupted!
    Any suggestions? Thank you!!

    Thanks for your help so far, BDAqua, Squirrel2 and Japamac.
    The only Mac I'm working with is actually this one here at school - the other computers at home and my new workplace are PCs running Windows XP and 7, so I guess reformatting the flash drive in HFS+ is out. The ultimate place I'd like to get the data stored is an external hard drive, but it of course has an NTFS filesystem, which a Mac can't write to... and the work-around I found (NTFS-3G for Mac OS X plus MacFuse) only works with 10.4 and up.
    When copying using the flash drive, I've always been connecting it to the direct ports on the towers (whether the G5 or my PC)
    We can't upgrade the OS due to software incompatibility/price issues, so I'm kind of stuck with it - argh! To add to that, I'm wary of running troubleshooting or drive maintenance on the G5 right now since it contains data and programs belonging to a number of other people, and it's not feasible just now to run the risk of letting it go out of commission, even for a day (it's thesis-writing season!). That said, I'd be willing to bet a good bit of money that the G5's hard drive is not in "good health," so I'm just going to try burning my data to a DVD so I can be done with this machine once and for all! I've had some issues in the past with writing DVDs on this G5, but it appears to be my last chance unless I'm willing to wait a while.
    A friend of mine suggested using Dropbox, which I was very gleeful about until finding out that Dropbox only works on 10.4 and up, as well!
    Anyway, thanks again for all of your help and suggestions!

  • HP 550 dvd drive auto ejects randomly

    Hi
    i have a hp550 notebook running win xp with sp2
    the problem is that dvd drive keeps ejecting  randomly with or without a disk in the drive

    I have same problem. My new notebook is HP Pavilion dv6t Quad Edition just one month. When I turn on power, dvd drvie auto eject. It can not be closed. If put a cd inside. it run and read nothing.
    What I can do...
    Thanks.

  • H: not found when insert the card of flash drive for auto import In Lightroom CC

    when i try to auto import Inside Lightroom 6 or CC getting an error "H: not found" as soon as i plug the memory card or any flash drive to the computer. i'm using lightroom CC win 7 64 bit

    Lightroom does reliably write capture time to industry-standard metadata fields in photos.   If you are indeed using the File > Import command a second time to re-import the photos after first importing them into LR, what's likely happening is that you're not telling LR to write the metadata changes back to the photos.  There are two ways to do this:  1) Select all the photos and do Metadata > Save Metadata To File, or 2) Select the option Catalog Settings > Automatically Write Changes Into XMP.  
    If this does not fix the issue, then you'll need to provide more detail about the precise steps you're taking, with command names and options.
    direct Lightroom to change each photo file name to match its new capture date
    Stepping back, re-importing the photos back into LR isn't necessary to rename photos with their capture date -- use the Library > Rename Photos command.

Maybe you are looking for