in

Brad Combs - News and information on the obvious, the not so obvious and the downright confusing.

Windows Embedded Standard - Tips, Tricks, How-To's and News.

HowTo: Determine the UFD where WinPE was booted

Applies to: WinPE 2.0+

Requirements: Ramdisk boot (not "Flat Boot")

 

This is a pretty common question because you need to locate the WIM image that you are going to apply to the device and it is stored on the UFD with a randomly assigned drive letter. When booting WinPE from a Ramdisk (standard method with PE 2.0 +), you are booting into a Ram drive with an assigned drive letter of X: Meanwhile, the underlying physical UFD is given a different drive letter (D:, E:, etc…). The drive letter can vary depending on the number of disks attached to the system. If you need to determine what the UFD drive letter is so you can access the WIM (or other files) look up the PEBootRamdiskSourceDrive value in the registry of WinPE. 

reg query "HKLM\SYSTEM\CurrentControlSet\Control" /v PEBootRamdiskSourceDrive 

So, the next logical question is “How can I script this so that it runs at startup?”. Copy the line below in a batch file and run it in startnet.cmd (or add the line directly to startnet.cmd): 

FOR /f "skip=2 tokens=3 delims= " %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control" /v PEBootRamdiskSourceDrive') DO SET SOURCEDRIVE=%%a
 

This will set a value of SOURCEDRIVE with the drive letter of the UFD where WinPE was loaded from. It sets it with the :\ as well (D:\, E:\, etc…). So in your scripts use the drive letter accordingly. Note that if you remove wpeinit.exe from startnet.cmd the PEBootRamdiskSourceDrive value will not be populated. If you want to remove wpeinit.exe, then add wpeutil updatebootinfo to startnet.cmd. Wpeutil will populate the values.

 

Comments

No Comments
© 2007 www.XPeFiles.com
Powered by Community Server (Commercial Edition), by Telligent Systems