Solved

Batch File (or other script) to remap a disk drive

Posted on 2011-02-28
7
692 Views
Last Modified: 2012-05-11
Hi All,

I'm looking to be able to remap a disk drive (typically D:) to another letter via a batch (or vbs?) script.  This should either (in my mind):

  -  Unmap the physical drive
  -  Try to map the physical drive to the last available letter
OR
  -  Disable the physical drive so that the letter is released
  -  Re-Enable the physical drive on the last available letter.

I know that it can all be done via Disk Management, however, this needs to be scripted.  It is also important that (where possible) the user should NOT need to restart their PC.

Any help is appreciated!!
0
Comment
Question by:Jofnn
7 Comments
 
LVL 12

Expert Comment

by:Amick
ID: 34997968
This may get you part of the way there:

net use * \\myComputer\D$

This command assigns default share D$ to the last available drive letter.



0
 
LVL 2

Expert Comment

by:seanyc111
ID: 34998020
have a look at mode or set in cmd
(use e.g. set/? in cmd  to see how the command is used
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 150 total points
ID: 34998292
this looks promising: http://support.microsoft.com/kb/300415

in short:
use command:
diskpart /s script.txt

Open in new window


in script.txt put something like:
select disk=5
select volume=7
assign letter=x noerr

Open in new window


This will obviously only work if your starting situation is always exactly the same, use diskpart interactively to find out what the available disks and volumes are. If it's not always the same you might be able to get output from diskpart first (list volume) and parse that to create a second command file.
0
 
LVL 3

Author Comment

by:Jofnn
ID: 34998837
Hi Robert,

That's exactly what I'm looking for... I've tested the theory (by re-mapping my own disk drive) and this works... I'll build a script around that and put on here in due course!
0
 
LVL 59

Expert Comment

by:LeeTutor
ID: 35331273
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now