Winpeshl.ini and startnet.cmd
#1
Posted 14 September 2007 - 12:00 AM
I want to specify my own shell in Winpeshl.ini but also want the network to start in the background.
Whats the best way to do that? (I'm using BS Explorer as my shell)
-james
#2
Posted 14 September 2007 - 10:49 PM
#3
Posted 17 September 2007 - 03:33 AM
You would need to list wpeinit.exe as the first item in wpeshl.ini and then list bs-explorer as the second (or pe-shell) either that or list startnet first with it calling wpeinit, the problem is you would still have to wait for wpeinit to run before it moves on to the next item.
I'd really like to have wpeinit started in the background so that it doesn't hold up the shell from starting, surely there must be an elegant way to do this?
-James
#4
Posted 17 September 2007 - 06:59 AM
I'd really like to have wpeinit started in the background so that it doesn't hold up the shell from starting, surely there must be an elegant way to do this?
-James
Hi James,
Here's an inelegant approach.
Bypasses wpeshl.ini and uses startnet.cmd.
No vpeldr.exe => no shortcut creation. No ShellSwapper.
CMD is the actual shell. Keep the CMD window alive.
... Winpeshl.exe will launch %SYSTEMDRIVE%\sources\setup.exe if it exists, otherwise it looks for an application specified in %SYSTEMROOT%\system32\winpeshl.ini. If no application is specified, Winpeshl.exe will execute cmd /k %SYSTEMROOT%\system32\startnet.cmd. By default, Windows PE contains a Startnet.cmd file which will launch Wpeinit.exe. Wpeinit.exe loads network resources and coordinates with networking components like DHCP.
VistaPE: How it Works
Description of VistaPE loading (full version with Grub2Dos)
- loading of Grub2Dos
- reading /menu.list
- loading bootmgr (loader of Windows Vista)
- reading into memory boot.wim (if used)
- initial loading of drivers and settings
- loading of "autorun.cmd" from "winpeshl.ini"
- loading vpeldr.exe - creation shortcut to programs, starting wpeinit.exe (detecting hardware, starting network) in background
- loading shell (PE Shell Swapper) from "winpeshl.ini"
- changing of screen resolution (PE Shell Swapper)
- selection and launching shell (from PE Shell Swapper)
Script: "3 - Shell & Config":
Comment out the following:
Echo,"Configuring shell..." #FileCreateBlank,"%TargetDir%\windows\system32\winpeshl.ini" #FileCreateBlank,%ES%<BR>#TXTAddLine,"%TargetDir%\windows\system32\winpeshl.ini","[LaunchApps]","Append" #TXTAddLine,"%TargetDir%\windows\system32\winpeshl.ini","autorun.cmd","Append" #TXTAddLine,"%TargetDir%\windows\system32\winpeshl.ini","PEShell.exe","Append"
Windows PE provides three methods for launching custom scripts: Winpeshl.ini, Startnet.cmd, and Unattend.xml...
Add a Custom Script with Startnet.cmd
You can add custom command-line scripts in Windows PE by using Startnet.cmd. By default, Windows PE includes a Startnet.cmd script located at %SYSTEMROOT%\System32 of your custom Windows PE image. Startnet.cmd currently starts Wpeinit.exe. Wpeinit.exe specifically installs Plug and Play (PnP) devices, processes Unattend.xml settings, and loads network resources.
1. Create a custom Windows PE image as described in "Walkthrough: Create a Custom Windows PE Image". During step 4 of that process ("Add additional customizations"), use the following steps.
2. Edit Startnet.cmd to include your custom commands.
Note: For PnP and networking support, make sure you include a call to wpeinit in your custom Startnet.cmd script
3. Save your changes and recapture your Windows PE image as described in "Walkthrough: Create a Custom Windows PE Image."
Script: "BS Explorer":
Add the following:
[Process] ... If,ExistFile,"%TargetDir%\windows\system32\startnet.cmd",FileDelete,"%TargetDir%\windows\system32\startnet.cmd" FileCreateBlank,"%TargetDir%\windows\system32\startnet.cmd" TXTAddLine,"%TargetDir%\windows\system32\startnet.cmd","#$q#$pSystemDrive#$p\Program#$sFiles\%OutDir%\%Executable%#$q","Append" TXTAddLine,"%TargetDir%\windows\system32\startnet.cmd","wpeinit","Append"
EDIT 6 Aug 2011: Fixed the html so the post can be read.
#5
Posted 05 August 2011 - 02:06 PM
[loadapps]
"start wpeinit.exe"
"yourapphere.exe"
#6
Posted 05 August 2011 - 09:27 PM
surely there must be an elegant way to do this?
Windows PE provides three methods for launching custom scripts: Winpeshl.ini, Startnet.cmd, and Unattend.xml...
Using an AutoUnattend.xml would allow you to do what you want.
Using <RunSynchronous> Command in your xml: "You can run two commands one right after the other."
<RunSynchronousCommand>
<Order>1</Order>
<Order>2</Order>
Using <RunAsynchronous> Command in your xml: "You can run two commands simultaneously."
<RunAsynchronous>
<Order>1</Order>
<Order>2</Order>
wpeinit is usually called from startnet.cmd "wpeinit"
call the AutoUnattend like this instead
wpeinit.exe /unattend=%SystemRoot%\System32\AutoUnattend.xml
wpeinit calls The AutoUnattend.xml and can set up network, drivers, screen resolution, etc
and could simultaneously load your shell.
something like this:
//
TXTAddLine,%UaFile%," <RunAsynchronous>",Append
TXTAddLine,%UaFile%," <RunAsynchronousCommand>",Append
// This is where you would tell BS Explorer to start
TXTAddLine,%UaFile%," <Order>1</Order>",Append
TXTAddLine,%UaFile%," <Path>%SystemRoot%\System32\BS Explorer.exe</Path>",Append
TXTAddLine,%UaFile%," <Description>BS Explorer</Description>",Append
TXTAddLine,%UaFile%," <Credentials>",Append
//TXTAddLine,%UaFile%," <Domain>FabrikamDomain</Domain>",Append This string type does not support empty elements. Do not create an empty value for this setting.
TXTAddLine,%UaFile%," <UserName>%pUser1%</UserName>",Append
TXTAddLine,%UaFile%," <Password>%pPassword1%</Password>",Append
TXTAddLine,%UaFile%," </Credentials>",Append
TXTAddLine,%UaFile%," </RunAsynchronousCommand>",Append
TXTAddLine,%UaFile%," <RunAsynchronousCommand>",Append
// Start something else here
// %SystemRoot%\system32\netcfg -winpe
TXTAddLine,%UaFile%," <Order>2</Order>",Append
TXTAddLine,%UaFile%," <Path>%cmd4%</Path>",Append
TXTAddLine,%UaFile%," <Description>cmd4</Description>",Append
TXTAddLine,%UaFile%," </RunAsynchronousCommand>",Append
TXTAddLine,%UaFile%," </RunAsynchronous>",Append
TXTAddLine,%UaFile%," </component>",Append
Using this method you can also call batch files that will load anything you want
in whatever order you want with some clever coding.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users