I have 10 workstations with large monitors that have USB slots and several card readers built in. The card readers cannot be disabled and will map to drive letters when I image the computers. I go into Disk Management and delete the drive mappings and add mappings to a single folder in C:\ with a folder for each slot. I have to do this because of scripts that run that are expecting specific letter drive mappings to network resources.
Is there a way to script the deleting and adding of drive mappings instead of having to use the Disk Management GUI manually on each workstation? The workstations are running XP Professional.
Based on sinping's comment to use diskpart, I was able to get a script working.
I made a batch file to create the folders to mount as follows: (
mkdir "C:\Removable Devices" mkdir "C:\Removable Devices\Slot1" mkdir "C:\Removable Devices\Slot2" mkdir "C:\Removable Devices\Slot3" mkdir "C:\Removable Devices\Slot4"
I made a script file that gets run using the line:
diskpart /s c:\temp\chgltrs.txt
For the workstations, volume 0 is the DVD-ROM and volume 1 is C which I found by running
diskpart and typing
list volume. I found out recently that it is better to select the volume by letter because the volume order can change if something is plugged in like a USB key.
The script is a follows: (
select volume e remove assign mount="C:\Removable Devices\Slot1" select volume f remove assign mount="C:\Removable Devices\Slot2" select volume g remove assign mount="C:\Removable Devices\Slot3" select volume h remove assign mount="C:\Removable Devices\Slot4"