Solved

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

Posted on 2011-02-28
7
702 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
creating a random password in batch 4 50
Embedding strings in MS DOS Batch File 9 57
VBS script  to map network printers to all users. 3 65
system default settings 4 53
It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

751 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