Jump to content

Recommended Posts

Posted

I'm after a script to run from the server to change a group of computer drive letters.

 

so I want to move drives 'E' and 'F' to 'Y' and 'Z'

 

Server is server 2008

workstations are XP Pro SP3

 

any help suggestions much appreciated

 

Cheers

 

Kev

Posted

found this to get you started

 

' Change the Drive Letter of a Volume


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & 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

 

bio..

  • Thanks 1
Posted
I'm after a script to run from the server to change a group of computer drive letters.

 

so I want to move drives 'E' and 'F' to 'Y' and 'Z'

 

Server is server 2008

workstations are XP Pro SP3

 

any help suggestions much appreciated

 

Cheers

 

Kev

 

Are you using logon / startup scripts to assign or map the drives in the first place ? If so then you can make the ammendments in those scripts ?

 

Generally those scripts are in the sysvol area afaik - could be wrong

 

If not and you are using group policy then am guessing you can use group policy to specify what drive letters you want mapping to each network share / mapping ?

  • Thanks 1
Posted

yes we have startup scripts for logon.

 

 

thats in a bat file

 

'Logon batch file to map any drives and change security group memberships

net use r: /d

net use t: /d

net use k: /d

net use r: \\W8E-DC01\Apps$

net use t: "\\W8E-DC01\Central Resource Library"

net use k: \\dfe4105dc2\mis

net localgroup Administrators MYSCHOOL\Technicians /add

Posted (edited)
found this to get you started

 

' Change the Drive Letter of a Volume


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & 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

 

bio..

 

Ok I tested that on my machine and it works, but is it possible to edit it so it does two drive letters rather than just on?

 

 

edit.... my machine in windows 7 ultimate

Edited by PEO
Posted
yes we have startup scripts for logon.

 

 

thats in a bat file

 

'Logon batch file to map any drives and change security group memberships

net use r: /d

net use t: /d

net use k: /d

net use r: \\W8E-DC01\Apps$

net use t: "\\W8E-DC01\Central Resource Library"

net use k: \\dfe4105dc2\mis

net localgroup Administrators MYSCHOOL\Technicians /add

 

Instead of using the other vbscript can't you just change the letters in the original script so it changes the letters there ie

 

 

net use r: /d
net use t: /d
net use k: /d
net use [b]A[/b]: \\W8E-DC01\Apps$
net use [b]B[/b]: "\\W8E-DC01\Central Resource Library"
net use [b]C[/b]: \\dfe4105dc2\mis
net localgroup Administrators MYSCHOOL\Technicians /add

 

where A, B and C are the drive letters you want

  • Thanks 1
Posted (edited)

I do not recommend using Z: as i'm sure its used by the system at netlogon for scripts, and so could cause an issue.

 

Edit, found this from MS "By default, Windows XP assigns mapped network drives to the highest available drive letter, starting with drive Z, to avoid drive letter collisions."

Edited by Quackers
  • Thanks 1
Posted
before I created the image for the machine I changed the drive letters but sysprep put them back to the begining. I'm a little stuck here as I dont fancy changing them, machine by machine everytime I depoly an image.
Posted
I think you need to look at the software that's creating the virtual CD drives - that's probably got an option to say "use drive Q:" rather than "use first available drive"
Posted

Diskpart should do

 

diskpart /s c:\scriptname.txt

 

The script would be:

 

select volume E

remove letter=E

assign letter=Y

select volume F

remove letter=F

assign letter=Z

exit

 

 

I've not tried it as a startup script however.

  • Thanks 1
Posted
Diskpart should do

 

diskpart /s c:\scriptname.txt

 

The script would be:

 

select volume E

remove letter=E

assign letter=Y

select volume F

remove letter=F

assign letter=Z

exit

 

 

I've not tried it as a startup script however.

 

Thank you for this I will take a look this morning

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



×
×
  • Create New...