Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help - Change CDRom Drive Letter

Status
Not open for further replies.

Jaws25

IS-IT--Management
Joined
Sep 4, 2003
Messages
11
Location
US
I would like to have a script find the first available cdrom and set it to drive e:

here is some code that will show cdrom devices drive letters but I can't figure out to actually change it.

Const DriveTypeCDROM = 4
Set oFS = Wscript.CreateObject("Scripting.FileSystemObject")
Set oDrives = oFS.Drives 'Loop thru A-Z. If found, exit early.
For Each Drive in oDrives
If Drive.DriveType = DriveTypeCDROM Then
Wscript.Echo Drive.DriveLetter
End If
Next

If you have advice please share.

thanks!!

- Jaws25
 
Hello Jaws25,

For general info

For specific change (system in this case), check out the ms article 223188:

You should have the win2000 up. The general info is applicable for other mounted devices. With it, you can make a script out of it. But, consider the broad repercussion before doing anything because it may be wide-spread.

regards - tsuji
 
Here is a great script I found on MS's site but it only works for server 2003.
Set objWMIService = GetObject("winmgmts:\\" & strSystemName & "\root\cimv2")
Set colVolumes = objWMIService.ExecQuery("Select * from Win32_Volume Where Name = 'D:\\'")
For Each objVolume in colVolumes
objVolume.DriveLetter = "E:"
objVolume.Put_
Next

Is there a way to do it with XP???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top