Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
_TAC_

change the drive letter of a harddisk/cd-drive

Recommended Posts

hello,

i'm looking for something like

http://www.microsoft.com/technet/community...s/scrdfs72.mspx

-------------------

Change the Drive Letter of a Volume

Description

Changes the drive letter of volume D to Q. If you modify this script to change the drive letter of a volume other than D, note that the volume name in the WQL query must include both the colon (:) and two forward slashes (\\). Thus drive C would look like this: C:\\. When specifying the new drive letter, however, you only have to include the colon (in the sample script, Q:).

Supported Platforms

Windows Server 2003 : Yes

Windows XP : No

Windows 2000 : No

Windows NT 4.0 :No

Script Code

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colVolumes = objWMIService.ExecQuery("Select * from Win32_Volume Where Name = 'D:\\'")

For Each objVolume in colVolumes

objVolume.DriveLetter = "Q:"

objVolume.Put_

Next

-------------------

The problem is that the "Win32_Volume" class doesn't exist under xp.

I need something that chances the driveletter for the dvd-rom to z: and the driveletter for the dvd-rw to m: during unattended setup.

thx for help

Share this post


Link to post
Share on other sites

Try using diskpart. DiskPart is part of the Win2K Server Resource Kit and the Win2K Professional Resource Kit. (Microsoft includes DiskPart as a core utility in Windows Server 2003 and Windows XP.)

diskpart /s CD-ROM.script > diskpart.Log

REM Select the CD-ROM Drive

SELECT VOLUME 0

REM And reset it's drive letter to Z:

ASSIGN LETTER=Z

REM Scan the disks to see the new volumes

RESCAN

EXIT

See also:

http://www.microsoft.com/resources/documen...s/diskpart.mspx

http://support.microsoft.com/default.aspx?kbid=300415

Share this post


Link to post
Share on other sites

F:->Z:

----swap_letter.cmd----

mountvol F: /L >%temp%\guid.txt

mountvol F: /D

for /f %%i in (%temp%\guid.txt) do mountvol Z: %%i

del /q %temp%\guid.txt

--------

Share this post


Link to post
Share on other sites

thx for the fast help.

@Ausmith1 : diskpart looks not very easy to use

@PaulD_ixbt : Your solution is exactly what i am searching for. I can also map my usb-card reader to a path with your script.

----

My configuration:

The cd/dvd-drive is allways the first drive, the cd/dvd-writer is the second one (sec. contr.). Two harddisks are linked at the other controller (pri. contr.).

In one System i have a promise pci controller with the boot harddisk and the data harddisk (pri master + sec. master) and the dvd-drive/dvd-writer are on the onboard one (pri. master + sec. master). The usb-card reader is - of course - at the usb port.

harddisk 1 --> C: D:

harddisk 2 --> E: F:

DVD-Rom --> G: (should be Z:)

DVD-Writer --> H: (should be M:)

USB-Card Reader --> I: J: K: L: (should be mapped to subdirectorys on d:\usb-card\ )

D:\usb-card>dir /b

1-cf

2-md

3-sm

4-sd

D:\usb-card>

(very stupid work to do it by hand each time after a new installation)

Now my next question: how can i reconize the "right" drive for each drive letter?

Share this post


Link to post
Share on other sites

Why does this not work in a batch file, yet works line by line in DOS window.

I get "f was unexpected at this time."

I simply want to rename my cdrom to Z when all is said and done.

--start of batch file---

for /f "Tokens=3" %f in ('"echo list volume|diskpart|find /i "rom""') do set cdrom=%f

mountvol %cdrom%: /L >%temp%\guid.txt

mountvol %cdrom%: /D

for /f %i in (%temp%\guid.txt) do mountvol Z: %i

del /q %temp%\guid.txt

--end of batch file---

On a different subject:

Does anyone know how I can put a timer on my version of Windows XP to expire after a certain amount of days. I've thought about a scheduled task that simply renames the password for the local admin account, but it seems to simple and easily detected, I was wondering if this has been discussed before anywhere?

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...