PEO Posted January 12, 2010 Posted January 12, 2010 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
bio Posted January 12, 2010 Posted January 12, 2010 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.. 1
mac_shinobi Posted January 12, 2010 Posted January 12, 2010 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 ? 1
mac_shinobi Posted January 12, 2010 Posted January 12, 2010 I have no idea what it means lol It's a vbscript that uses wmi and the win32_Volume class to change drive letters of a specific partition / drive 1
PEO Posted January 12, 2010 Author Posted January 12, 2010 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
PEO Posted January 12, 2010 Author Posted January 12, 2010 (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 January 12, 2010 by PEO
mac_shinobi Posted January 12, 2010 Posted January 12, 2010 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 1
PEO Posted January 12, 2010 Author Posted January 12, 2010 sorry I should have said, the drive letters I wish to change are virtual cd/dvd drives
Quackers Posted January 12, 2010 Posted January 12, 2010 (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 January 12, 2010 by Quackers 1
PEO Posted January 12, 2010 Author Posted January 12, 2010 Cheers Quackers, you learn something new everyday I didnt know that
PEO Posted January 12, 2010 Author Posted January 12, 2010 screen shot of error message on a machine running Windows xp pro sp3
Danlewis3 Posted January 12, 2010 Posted January 12, 2010 That script only works for mapped drives i believe your virtual ones will be done via software i think
PEO Posted January 12, 2010 Author Posted January 12, 2010 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.
srochford Posted January 12, 2010 Posted January 12, 2010 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"
DMcCoy Posted January 12, 2010 Posted January 12, 2010 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. 1
PEO Posted January 13, 2010 Author Posted January 13, 2010 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now