Jump to content

change drive letter script


Recommended Posts

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!!

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...