Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

UPDATE:

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: (mksltdirs.bat)

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: (chgltrs.txt)

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"
share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Take a look at the diskpart command. I haven't used it with card readers but it should be able to do it. You can look at the setup on one machine you have configured already and just copy most of that config over to another one to import as a batch.

share|improve this answer
    
@Joseph: If just out-right disabling the card readers is acceptable, look at devcon. You can enable/disable devices from the command line support.microsoft.com/kb/311272 –  jscott Apr 5 '10 at 18:17
add comment

The card readers are USB devices, meaning they're in the device manager... either disable the card-reader devices in Device Manager, or disable that particular USB root-hub that the card-reader is connected to.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.