[Windows 7] Script to eject / unmount and remount external USB disk
#1
Scooby Regular
Thread Starter
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes
on
0 Posts
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
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"
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
![Stick Out Tongue](https://www.scoobynet.com/images/smilies/tongue.gif)
#4
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
You can use schedule manager, but the actual commands look nasty...
http://superuser.com/questions/29591...s-the-unix-way
http://superuser.com/questions/29591...s-the-unix-way
#6
Scooby Regular
iTrader: (1)
Join Date: Oct 2010
Location: Darlington
Posts: 500
Likes: 0
Received 0 Likes
on
0 Posts
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
If you save this as a .vbs file, and replace "e:" with the drive letter it will unmount the drive:
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.
Code:
Set shell = WScript.CreateObject("WScript.Shell") shell.Run "mountvol e: /d"
It uses mountvol (http://technet.microsoft.com/en-us/l...8WS.10%29.aspx) if you want to play around with it.
#7
Scooby Regular
Join Date: Apr 2004
Location: Cardiff
Posts: 1,928
Likes: 0
Received 0 Likes
on
0 Posts
Trending Topics
#8
Scooby Regular
Thread Starter
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes
on
0 Posts
![Default](https://www.scoobynet.com/images/icons/icon1.gif)
If you save this as a .vbs file, and replace "e:" with the drive letter it will unmount the drive:
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.
Code:
Set shell = WScript.CreateObject("WScript.Shell") shell.Run "mountvol e: /d"
It uses mountvol (http://technet.microsoft.com/en-us/l...8WS.10%29.aspx) if you want to play around with it.
Thanks to everyone for the help, when I have a spare moment I will give it a shot.
Thread
Thread Starter
Forum
Replies
Last Post
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM