Jump to content

REMOVE ASSIGNED DRIVES


Recommended Posts

Greetings!

I've the following issue:

When Windows is installed and OOBE batch file is ran the network drives are not all mapped because the drive letter is often already occupied by some useless dummy card reader (i.e. it's not actually used).

The various solutions provided by M$ all have serious holes since I either have to know the drive number or it doesn't work in cmd.

IDEALLY, I would like to simply enter the mapped drives in cmd and let windows dismount and change assigned letters of other devices automatically (er, not going to happen).

THEREFORE, I'm trying to find a way to simply dismount all assigned letters to devices or drives (apart from C: obviously) so that the mapped drives would all be available. And then upon restart, hopefully the dismounted devices would find their new home :)

There must be SOMETHING that would accomplish the above in a batch script?

:unsure:

Link to comment
Share on other sites


*SOLVED*

Well sort of, it'll have to do:

In three steps:

1: mountvol X: /D (this will dismount any device on "X:")

2: net use X: \\server_name\driveorfolder PASSWORD /USER:%COMPUTERNAME%\Administrator /PERSISTENT:YES (This will mount the drive/folder to X:)

3: %SYSTEMROOT%\explorer.exe X:\ (open the new mapped drive, this for some reason was needed to make it all work properly after reboot)

4: taskkill /f /im explorer.exe and then explorer.exe (Restart Explorer before rebooting)

PS - Obviosuly network credentials must be installed for all this to work without entering passwords afterwards i.e.

REM Permanently store network credentials:

cmdkey /add:192.168.0.99 /user:Administrator /pass:PASSWORD

cmdkey /add:SERVERNAME /user:Administrator /pass:PASSWORD

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...