Link to home
Start Free TrialLog in
Avatar of Jofnn
JofnnFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

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!!
Avatar of Amick
Amick
Flag of United States of America image

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.



Avatar of seanyc111
seanyc111

have a look at mode or set in cmd
(use e.g. set/? in cmd  to see how the command is used
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jofnn

ASKER

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!
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.