Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

[Windows 7] Script to eject / unmount and remount external USB disk

Thread Tools
 
Search this Thread
 
Old 20 April 2012, 12:28 PM
  #1  
Markus
Scooby Regular
Thread Starter
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default [Windows 7] Script to eject / unmount and remount external USB disk

A question for those with far more expertise in Windows 7 than I have.
Here is the scenario:
1. I have a machine running Windows 7 Home Premium.
2. I have a 320GB external hard drive, connected via USB.
3. I have use the built in backup utility to create a backup.

The problem is that the person whose machine it is does not want the external drive mounted all the time, they claim it is too noisy, yet it is quieter when it's ejected / unmounted.

What I'd like to be able to do is to have a script, which can be scheduled and run on demand (if it's two scripts, that is fine) that will check if the drive is mounted and if so, unmount it. If it's not mounted it will mount it.

On OS X, if I unmount a disk then it is still "there" as it were, i.e.; you can make a mount call to mount it, but the drive is essentially sleeping. I'm unsure if Windows 7 works in a similar way, or wether when a disk is ejected that's it, you need to power cycle it to get it to reappear.

Any help or suggestions are greatly appreciated, well, apart from "get a mac" (It *is* a mac 2006 Intel iMac, just that the person wants to use Windows rather than OS X for some inexplicable reason) and "get a quiet drive"
Old 20 April 2012, 12:32 PM
  #2  
SwissTony
Scooby Regular
iTrader: (19)
 
SwissTony's Avatar
 
Join Date: Mar 2003
Location: In the Doghouse
Posts: 28,228
Received 12 Likes on 3 Posts
Default

Originally Posted by Markus

Any help or suggestions are greatly appreciated, well, apart from "get a mac" (It *is* a mac 2006 Intel iMac, just that the person wants to use Windows rather than OS X for some inexplicable reason) and "get a quiet drive"

Get a less annoying colleague
Old 20 April 2012, 12:45 PM
  #3  
Markus
Scooby Regular
Thread Starter
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by SwissTony
Get a less annoying colleague
Not an option, well, not a cheap one, it's my Wife!
Old 20 April 2012, 12:59 PM
  #4  
boxst
Scooby Regular
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Default

You can use schedule manager, but the actual commands look nasty...

http://superuser.com/questions/29591...s-the-unix-way
Old 20 April 2012, 01:15 PM
  #5  
Neanderthal
Scooby Regular
iTrader: (6)
 
Neanderthal's Avatar
 
Join Date: Jun 2001
Location: Northampton, Xbox GamerTag - Neanderthal1976
Posts: 6,850
Likes: 0
Received 0 Likes on 0 Posts
Default

Can't you adjust the 'power saving' of Windows so that it powers down the external drive if unused for a certain amount of time?
Old 20 April 2012, 02:10 PM
  #6  
MDS_WRX
Scooby Regular
iTrader: (1)
 
MDS_WRX's Avatar
 
Join Date: Oct 2010
Location: Darlington
Posts: 500
Likes: 0
Received 0 Likes on 0 Posts
Default

If you save this as a .vbs file, and replace "e:" with the drive letter it will unmount the drive:
Code:
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "mountvol e: /d"
I haven't figured out how to get the drive back yet though!

It uses mountvol (http://technet.microsoft.com/en-us/l...8WS.10%29.aspx) if you want to play around with it.
Old 20 April 2012, 04:43 PM
  #7  
mike1210
Scooby Regular
 
mike1210's Avatar
 
Join Date: Apr 2004
Location: Cardiff
Posts: 1,928
Likes: 0
Received 0 Likes on 0 Posts
Default

This isn't a script but may help:

http://mt-naka.com/hotswap/index_enu.htm


Trending Topics

Old 23 April 2012, 01:37 PM
  #8  
Markus
Scooby Regular
Thread Starter
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by MDS_WRX
If you save this as a .vbs file, and replace "e:" with the drive letter it will unmount the drive:
Code:
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "mountvol e: /d"
I haven't figured out how to get the drive back yet though!

It uses mountvol (http://technet.microsoft.com/en-us/l...8WS.10%29.aspx) if you want to play around with it.
Looking at the tech note, getting it mounted should be a case of simply calling it via the GUID of the drive. Did not have a chance to try that, or anything though!

Thanks to everyone for the help, when I have a spare moment I will give it a shot.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
FuZzBoM
Wheels, Tyres & Brakes
16
04 October 2015 09:49 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM



Quick Reply: [Windows 7] Script to eject / unmount and remount external USB disk



All times are GMT +1. The time now is 11:09 AM.