Jump to content











Photo
- - - - -

Script Drive Letter Change in WinPE 3.0


  • Please log in to reply
7 replies to this topic

#1 crazykroger

crazykroger
  • Members
  • 4 posts
  •  
    United States

Posted 13 November 2009 - 03:50 PM

Hello,

I am a desktop admin that administers 300 computers and 10 different models and this is what I am trying to do. I have written a batch file to create, append, and apply a WIM image with ImageX, however in my script I have to hard code the drive letter. Also, I edited startnet.bat to change the path from X:\Windows\System32 to E:\, but since I have 10 different models the USB drive letter does not stay consistent. What I want to do is change the USB drive letter to T:\ that way I can edit my WIM script and startnet.bat to work from T:\ and not have the inconsistencies that I am currently having. I have tried scripting the letter change with diskpart, however I am still facing inconsistency issues with the “volume #” (my USB drive fluctuates from “volume 0” to “volume 3”). There is one thing I have found consistent on the WinPE boot and that is in diskpart if you do a “list disk” the internal HD is “disk 0” and my USB is “disk 1”. Can anyone help me with my dilemma? Help is greatly appreciated!

#2 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 13 November 2009 - 05:47 PM

I am not understanding fully the problem.

You are booting off a USB device?

And you want that device to get a consistent drive letter in WHAT?

I mean WHAT are you booting from the USB device?

A PE 1.x, a PE 2.x, a PE 3.x?

What is the problem in assigning to the USB device a "static" drive letter in the PE?

jaclaz

#3 crazykroger

crazykroger
  • Members
  • 4 posts
  •  
    United States

Posted 13 November 2009 - 07:13 PM

I am booting off of a USB flash drive into WinPE 3.0. Some PC's that I administer have no CD ROMS, most have one, and some have two, so my drive letter for the USB flash drive is assigned as D:\ E:\ or F:\ respectively. What I am wanting is to change that drive letter to T:\ however I am unable to find a consistant way of accomplishing this.

#4 cdob

cdob

    Gold Member

  • Expert
  • 1469 posts

Posted 13 November 2009 - 07:37 PM

Do you run Windows 7?

Export registry setting USB stick MountedDevices\DosDevices.
Import setting to your WinPE.

#5 crazykroger

crazykroger
  • Members
  • 4 posts
  •  
    United States

Posted 16 November 2009 - 03:30 PM

Sorry don't use Windows 7 our company and I personally use Windows XP. Don't have the resources anymore to obtain latest version of Windows.

#6 allanf

allanf

    Gold Member

  • .script developer
  • 1256 posts

Posted 16 November 2009 - 05:19 PM

Another way that many people use is to place a tag file on the external media - something unique like ExtrnlDr.txt - and when the PE boots up, automatically run a batch file to search for the tag file, determine the external media's drive letter, and assign the drive letter to a variable. Your scripts wouldn't need a hard-coded drive letter.

If you need the batch file, I can have a look for it. It's been around a while - Nightman posted it in the forums once. There's probably a vb script to do something similar - check out the Scripting Guy on technet.

Regards :drunk:

#7 crazykroger

crazykroger
  • Members
  • 4 posts
  •  
    United States

Posted 18 November 2009 - 11:33 PM

Yea that is something that I would like to implement however I tried another vbscript on the pe but it won't run it wants to open it in notepad... Any ideas or a link to a forum that will fix this error?

#8 allanf

allanf

    Gold Member

  • .script developer
  • 1256 posts

Posted 19 November 2009 - 05:12 AM

Yea that is something that I would like to implement however I tried another vbscript on the pe but it won't run it wants to open it in notepad... Any ideas or a link to a forum that will fix this error?


vb script in WinPE requires the OS Scripting Package. It is installed into WinPE 2.x using:

\Tools\PETools\peimg.exe /install="*#1*" "%TargetDir%\Windows"
where #1 is the abbreviated name of package, such as XML, Scripting, HTA, etc. Wildcards (*) will ensure that the package's language is also installed. %TargetDir% is the mount point/directory for the mounted winpe.wim index 1. In WinPE2.x, the packages are already staged in the base winpe.wim, but still need to be properly installed. If the image has been 'peimg /prep', such as the boot.wim from the Vista Install DVD, the packages will not be available and cannot be installed.

Using DISM with WinPE 3.0 is slightly different. I think the package needs to be added to the mounted image by selecting the package from the 'Windows AIK' directory. Etc.

However, I would try to use the batch script in startnet.cmd. This is what I use to find a tag file pe_Progs.txt in a custom Programs Files folder which could be either in RAM (X:) or on external media depending on the setting.

Adapted hastily from winbuilder script, so not sure if it's all OK.
@ECHO OFF

SET target="Program Files\pe_Progs.txt"

For %%A in (X C D E F G H I J K L M N O P Q R S T U V W Y Z) Do (

If Exist %%A:\%target% SET PROGSDRIVE=%%A:& Goto :EndProgs

)

:EndProgs

ECHO Programs Drive is %PROGSDRIVE%

ECHO.

Regards :dubbio:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users