Sign in to follow this  
Followers 0
Arthur L

change drive letter script

4 posts in this topic

Hello Guys,

I need to change the drive letter for some 50 computers across the network. The current drive letter is "D" and I need to change it to "E" as per company policy.

I have found a vbs script to do this:

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 = "E:" 
objVolume.Put_ 
Next

Unfortunately, Win32_Volume class doesn't work in WindowsXP since this is new in Windows 2003.

I would ask for your help if this script is possible using autoit.

Thanks!!

Share this post


Link to post
Share on other sites



You could also create a macro that does that kind of thing. :whistle:

Share this post


Link to post
Share on other sites

Unfortunately, Win32_Volume class doesn't work in WindowsXP since this is new in Windows 2003.

I would ask for your help if this script is possible using autoit.

Thanks!!

Look into DiskPart.exe, It's comes with Windows XP and I believe it will also run on 2000 but you will have to copy it to the PC first.

You need to build a Config.dat file with the following lines

Select Disk=1

Select Partition=2

assign Letter=E

exit

Then launch Diskpart as the following

Diskpart.exe /s Config.dat

Let me know if you need any more info.

Mike


Share this post


Link to post
Share on other sites

thanks MikeOsdx, this seems to be what I am looking for!

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  
Followers 0