Aug 18, 2011
tom

script Disk Management configuration

Question

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 DevicesSlot1"
mkdir "C:Removable DevicesSlot2"
mkdir "C:Removable DevicesSlot3"
mkdir "C:Removable DevicesSlot4"

I made a script file that gets run using the line: diskpart /s c:tempchgltrs.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 DevicesSlot1"select volume f
remove
assign mount="C:Removable DevicesSlot2"select volume g
remove
assign mount="C:Removable DevicesSlot3"select volume h
remove
assign mount="C:Removable DevicesSlot4"

Answer

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.

Related posts:

  1. disk management/diskpart on windows server 2008 hangs
  2. Difference betwen logical disk and volume in windows OS?
  3. Force Windows to recalculate disk size on VM after resizing hard drive
  4. Windows Server 2003 not automatically assigning drive letter to external drives
  5. IBM BladeCenter S: Disk Configuration

Leave a comment