Brian Madden Logo
Your independent source for application and desktop virtualization.
Marketplace

advertisement

Changing drive letter in script, in the Scripting / Automation forum on BrianMadden.com

rated by 0 users
This post has 7 Replies | 0 Followers

Guest Posted: 11-10-2005 1:14 PM
I'm trying to find what the command would be to change the drive letter in a script. For example if I wanted to change the drive from c: to d: I could type just that. Is there a difference when doing from a script?
  • | Post Points: 80
Top 10 Contributor
Points 20,562
Depends on what scripting language you are using. In a Windows batch file the command would simply be "d:" (without the quotes).

Rudy

  • | Post Points: 5
Top 150 Contributor
Points 1,280
Hi,

you can use the following vbscript.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colVolumes = objWMIService.ExecQuery _
("Select * from Win32_Volume Where Name = 'C:\\'")

For Each objVolume in colVolumes
objVolume.DriveLetter = "D:"
objVolume.Put_
Next


Good luck!

\\Ivan de Mes
  • | Post Points: 5
Top 10 Contributor
Points 87,103
Yea, I would HIGHLY recommend NOT doing this to a volume drive letter. Your server will crash repeatedly if it comes back up after a reboot at all. Which it won't.
  • | Post Points: 20
Top 150 Contributor
Points 1,345
If you do need to change a drive letter, do it before installing Citrix. Citrix themselves make a utility that does it for you. The file is DriveRemap.exe, you can automate this in a script, like the following:

driveremap /u /drive:M /noreboot

This command will remap the servers drives starting with the first available drive to M: and not display any dialog boxes or require any input.

For more information about this command, check out this link:

http://support.citrix.com/kb/entry.jspa?entryID=1985

Brett Gilmour
  • | Post Points: 5
Top 150 Contributor
Points 1,345
Ok after reading your post again, it looks like I have misunderstood what you are wanting to do. Why do you need to change to the D: for?

If you are wanting to install applications, I would recommend using MSIEXEC /i D:\Filename.MSI /quiet

You dont need to change to D: if you use that method.

You can also use \\server\share instead of using a drive.

Brett Gilmour
  • | Post Points: 5
Top 150 Contributor
Points 1,280
Like Jeff said. Do not use the script on volumes where the OS resides. This script is just an example. You must use the drive remap util from Citrix to accomplish it on a OS contained volume.

\\Ivan de Mes
  • | Post Points: 5
Not Ranked
Points 5
Folks I have a server 2003 terminal server which has a drive W:. I beleive the last tech remapped drive c to be w: However drive c: is still intact but this drive w: shows as a volume drive. I would like to unmap this drive as it is confusing our users. Any way to dump it would be appreciated. There is nothing really installed on W:
  • | Post Points: 5
Page 1 of 1 (8 items) | RSS
Copyright © 1997-2008 The Brian Madden Company, LLC | Disclosures | Privacy | Terms of Use | Contact Info