Jump to content

Change default drive letter


pr1ngl3

Recommended Posts

After 2 full days of searching and researching I have come up blanks so was hoping someone could help me.

I have hundreds of scripts written by 3rd parties that I need to incorporate into a WIM, the trouble is all the scripts are hard coded to reference an X: drive. I can not rework the scripts becuause of licensing and liabilities so need to find a way of getting WinPE to alllow me to physically set the drive letter it loads as the RAM drive and subsiquently mount a device as the X: drive.

I have looked into SUBST but it will obviously not allow substitution of the %Systemdrive%

I have looked at DOSKEY but the complexity because of the number of hardcoded references to X:\<whatever>\<whatever>\<whatever> far outweighs the possibilities

I have looked at the options within bcdedit > devobject > {ramdisk} but there is nothing associated with the drive letter

I can't believe MS would hardcode the drive letter so deeply that it can not be changed, I know with the intruduction of WMI the registry needs a hardcoded reference, but surely this can be dynamic up to the point of creating the RAM Drive, even if this means rebuilding the sdi.

Link to comment
Share on other sites


  • 1 month later...

After 2 full days of searching and researching I have come up blanks so was hoping someone could help me.

I have hundreds of scripts written by 3rd parties that I need to incorporate into a WIM, the trouble is all the scripts are hard coded to reference an X: drive. I can not rework the scripts becuause of licensing and liabilities so need to find a way of getting WinPE to alllow me to physically set the drive letter it loads as the RAM drive and subsiquently mount a device as the X: drive.

......

I can't believe MS would hardcode the drive letter so deeply that it can not be changed, I know with the intruduction of WMI the registry needs a hardcoded reference, but surely this can be dynamic up to the point of creating the RAM Drive, even if this means rebuilding the sdi.

You can try the following:

First, mount the boot.wim file which is the winPE-

Dism /Mount-Wim /WimFile:D:\data\boot.wim /index:1 /MountDir:D:\data\tmpWimMount

which mounts the boot.wim file (located at D:\data\ folder) to a new folder (D:\data\tmpWimMount)

Then ask for PE environment settings-

Dism /image:D:\data\tmpWimMount /Get-PESettings

One of these information displayed is the windows root directory (such as "X:$windows.~bt\windows")

Alternatively, you can also get the Windows Root Directory information directly by issuing the following command-

Dism /image:D:\data\tmpWimMount /Get-TargetPath

You can reset the root directory to something you want. Most of the time, for custom WinPE, and especially when building Win7PESE via winbuilder, or for LastOS custom PE via the lastos builder, you need to set the windows root directory to "X:\". You must issue-

Dism /image:D:\data\tmpWimMount /Set-TargetPath:X:\ (or some other drive letter)

Finally, you have to commit the changes and unmount the boot.wim image-

Dism /Unmount-Wim /MountDir:D:\data\tmpWimMount /commit

Repeat the above steps for boot.wim index=2 image as well, and make sure the target path is the same as what you have specified for boot.wim index=1 image. Commit changes and unmount boot.wim index-2 image.

Then try out your scripts and see if that works.

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
  • Recently Browsing   0 members

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