Topic: PXE Boot for SE and XPE projects  (Read 1773 times)

PXE Boot for SE and XPE projects
« on: January 09, 2019, 05:55:55 AM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
This is not a plugin - This is a PXE Server Creation tool for your use with your finished ISO

As usual it seems our Russian friends have found another good idea.  And as usual I would like to make that idea turn key for us   :great:

It has only been tested on SE so far.  I am posting here for collaboration and help finishing the tool for ALL projects.  Use 7zip to extract the source CMD file from the EXE to contribute. 

PXE Server Tool v2:  * PXEServerTool_v.2.7z (1438.72 kB - downloaded 150 times.)

Recommended PXE Server Requirments:
Win8+ Supported
10/1000 Network Card (Setting a static IP before using PXE Server Tool is recommended but not required)
*Any Workstation connected to your network will do



Instructions:

To Create a PXE Server

1.) Drag and drop your XPE or SE ISO onto PXESetup.exe to begin (The network this machine is on will become your PXE network)
2.) When the tool is done, AOMEI PXE Boot Free will open
3.) Select "Boot from custom image file" then click "Browse"
4.) Select "PXEBoot.wim" then click "Open"
5.) Click "Start Service"

*Use CleanupPXE.CMD between tests to remove the PXE server and start fresh

To connect a client

1.) Plug in a network cable to the client, Set Legacy boot to ON in your client machine's BIOS(UEFI is not supported YET), and select PXE Boot from your boot menu  :thumbsup:



How it works:

The tool downloads AOMEI PXE Boot Free 1.5 and silently installs it in your computer. 
It mounts your ISO and copies the contents into the server, recreating the correct structure.
It unmounts the ISO. 
DISM is used to mount boot.wim.
It then prepares your PE for PXE, changing SwitchToAdmin.ini and SwitchToAdminLogon.ini OR PECMD for System account to prevent pintool and mountpemedia from running.
It creates a user named PXE for the network share
It shares out the folder your programs are in
It finds the local IP address of the PXE Server and bakes in a command to map a network drive back to the server after the network starts with user PXE.
It creates PXEBoot.CMD at the root of X, this performes the Y:\ map and runs PinTool at the end of boot
DISM then unmounts and commits the changes to the boot wim. 
AOMEI PXE Boot is then started in the working directory of your new PXEBoot.wim.
« Last Edit: January 26, 2019, 02:57:30 AM by bob.omb »

Re: PXE Boot for XPE and SE projects
« Reply #1 on: January 11, 2019, 08:04:33 AM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
Tool updated v.1a ==> v.1b in OP. Should work perfectly now for SE project ISO's, and most likely XPE project ISO's as well.   :thumbsup:

Re: PXE Boot for SE and XPE projects
« Reply #2 on: January 12, 2019, 01:20:39 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
Hi bob.omb
It hadn't come to mind before but just now.
2aCD, a very good PE developer that we currently lack,
had developed a plugin with a partly similar purpose here PXE-Boot-Script
The Plugin is included in Win8.1SE 0_PXESupport.script

Note on PXE Support plugin:
For correct work it's necessary to start Network before shell. Enable this option in PENetwork
To get shortcuts on the network drive, Select '2 - MakeShortcuts' in Finals folder. to Make Shortcuts at Build time
NetUse.exe is from 2aCD

I hope it can help, it doesn't do anything on the server side.

Re: PXE Boot for SE and XPE projects
« Reply #3 on: January 12, 2019, 02:27:53 AM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
The above tool works.  I was able to get it working correctly. Pintool.exe and shotcuts.exe are traversing the network and pinning.  :wink:

Everything launches quickly and works well on the client side.

I need to add a line for icacls to give ownership of the PXEFiles (Y:\) to the PXE user during setup.  Everything but making backups is working because the PXEFiles folder is located in ProgramFiles(x86)\AOMEI*\PXEFiles on the PXE server

Only trusted installer has rights there so read-only, launching programs works but for write access:

Code: [Select]
icacls "%PXEFolder%" /setowner "PXE" /T /C /Q > nul

should be fine to add to the tool



NET Framework working perfectly across mapped drive on Y:\

All of this setup is happening on the host PXE server.  I am making it so you take your normal completed PE ISO and the tool does all the work of switching when the network starts and adds drive mapping etc AFTER build.

This way you can use the same ISO to burn to USB and this tool will convert it for PXE compatibility automatically when launching.

Also it is effortless.  You drag and drop then wait a moment then "start service" - It is more practical to make a tool that does this all to any Oven.org project ISO without the need to do anything special beforehand.  Without creating credentials and assigning shares and permissions..  It is just a very simple tool that does it all for you quietly and reliably works..  :cool:  I think this is the correct approach to a PXE solution.

I will use the info you provided to make it better, thanks Chris  :thumbsup:

« Last Edit: January 12, 2019, 05:40:45 AM by bob.omb »

Re: PXE Boot for SE and XPE projects
« Reply #4 on: January 12, 2019, 05:42:26 AM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
@Chris or @Lancelot,

   The AddAutorun, used to start PENetwork before shell.

Code: [Select]
AddAutoRun,,%PE_Programs%\%ProgramFolder%\StartAlternateNetwork.exe,,3

Where does this macro get the autorun to start from before the shell?  I do not know ML  :embarrassed:

Re: PXE Boot for SE and XPE projects
« Reply #5 on: January 12, 2019, 08:09:24 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
You don't have to know ML for such things, test with a codebox.
Answer:
Win10PE.cfg [autorun]

Re: PXE Boot for SE and XPE projects
« Reply #6 on: January 12, 2019, 03:54:13 PM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
Tool updated to v2 in OP.

It is working without starting the network before shell and does not have a long delay.  This way ISO's that start network before/after shell both work.. 

*Fixed an issue where the Y:\ was not writable and behaving like a CD/DVD

-------

100% Working for SE ISO's :thumbsup:  Report any issues here  :wink:

Even though this works fine, now I can clean it up more, and..
- work on UEFI compatibility. (Will use Custom Server in next version)
- check XPE project ISO compatibility
- add compatibility for ISO's that do not use the CdUsb.Y marker.
« Last Edit: January 12, 2019, 05:04:00 PM by bob.omb »

Re: PXE Boot for SE and XPE projects
« Reply #7 on: January 12, 2019, 10:18:15 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi Bob.Omb

100% Working for SE ISO's :thumbsup:  Report any issues here  :wink:
not tested, but reminding:
Build\CdDrive - X: - Y:
have 2 options:
1)
checkbox:
Run ALL programs from RAM
(pack them in WIM file, needs a lot of memory)
2)
Button:
Disable Plugin and Reset to Default settings

eg.
Test with
Apps\File Tasks\Q-Dir Nenad
plugin which is normally at Y:\ but with 2 above options it will be at X: without changing any setting on "Q-Dir Nenad" plugin.

Only reminding: Be sure your pxe adjustment work with both options. (maybe already working, only a memo.)

:turtle:

Re: PXE Boot for SE and XPE projects
« Reply #8 on: January 12, 2019, 11:01:23 PM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
Right now to mount the ISO and start the process CdUsb.Y is needed.  It can be placed in an ISO root after build if it is not already present.  Everything will still work if you have all your programs loaded into RAM however PXE Boot will take a longer time the bigger the WIM is...

After mounting the ISO with Powershell:

Code: [Select]
POWERSHELL.EXE "Mount-DiskImage ""%1""" >nul

The tool uses the below code to get the drive letter of the mounted ISO and proceed with the file copy:

Code: [Select]
FOR /f "tokens=3 delims=\:" %%d in ('reg query hklm\system\mounteddevices ^| findstr /c:"5C003F00" ^| findstr /v "{.*}"') do ( 
IF EXIST %%d:\CdUsb.Y SET SOURCE=%%d
)
IF NOT EXIST %SOURCE%:\CdUsb.Y GOTO NOTCOMPAT
« Last Edit: January 12, 2019, 11:07:22 PM by bob.omb »

Re: PXE Boot for SE and XPE projects
« Reply #9 on: January 13, 2019, 08:01:09 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi Bob.Omb,

reminding:
@Bob.Omb
you have to be careful when using For, to be sure result expected better use slore skip way.
see how I used at reply 37
http://theoven.org/index.php?topic=2669.msg30387#msg30387
For /f "%SKIP_OPT%delims=".......

It is missing on things you will find on internet....

If you do not, and decide to go on For /f path, you may get unwanted first lines on your new file after txt replace...

:turtle:

not tested, following your codes this should work:

Code: [Select]
Call :Calculate_Skip
FOR /f "%SKIP_OPT%tokens=3 delims=\:" %%d in ('reg query hklm\system\mounteddevices ^| findstr /c:"5C003F00" ^| findstr /v "{.*}"') do ( 
IF EXIST %%d:\CdUsb.Y SET SOURCE=%%d
)
IF NOT EXIST %SOURCE%:\CdUsb.Y GOTO NOTCOMPAT
...
...
...
...

:Calculate_Skip
rem calculate the skip line(s) of AutoRun output slore Reply 5 Way2 http://TheOven.org/index.php?topic=2669.msg29916#msg29916
Set /a SKIP_N=-1
For /f "delims=" %%A In ( 'Echo Test' ) Do set /a SKIP_N+=1
if %SKIP_N% NEQ 0 (set SKIP_OPT=skip=%SKIP_N% )
Goto:EOF
:::Calculate_Skip Tests:
:: SKIP_N becomes 0 with default windows cmd settings
:: SKIP_N becomes 1 if windows cmd produce 1 additional line (via Autorun etc.)
Echo SKIP_N %SKIP_N%
:: SKIP_OPT have no value with default windows cmd settings
:: SKIP_OPT becomes skip=1 if windows cmd produce 1 additional line (via Autorun etc.)
Echo SKIP_OPT %SKIP_OPT%
::Further tests with simple echo:
For /f "%SKIP_OPT% delims=" %%A In ( 'Echo Test' ) Do Echo Result: "%%A"
For /f "%SKIP_OPT% delims=" %%A In ( 'cmd.exe /D /C Echo Test' ) Do Echo Result: "%%A"
For /f "%SKIP_OPT% usebackq delims=" %%A In ( `Echo Test` ) Do Echo Result: "%%A"
For /f "%SKIP_OPT% usebackq delims=" %%A In ( `cmd.exe /D /C Echo Test` ) Do Echo Result: "%%A"


:turtle:
« Last Edit: January 13, 2019, 08:01:39 AM by Lancelot »

Re: PXE Boot for SE and XPE projects
« Reply #10 on: January 16, 2019, 05:13:59 AM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
I dont know why I did not think of it before, but:

Code: [Select]
:Verify
NET USE Y: \\%IPAddress%\WinPEData /user:PXE PXEBOOT > nul
PING 127.0.0.1 -n 1 > nul 
IF EXIST "Y:\CdUsb.Y" GOTO ProcessPXE
GOTO Verify
:ProcessPXE
X:\Windows\system32\shortcuts.exe -f X:\Windows\System32\Win10PE.cfg
X:\Windows\system32\PinTool.exe -debug X:\Windows\System32\Win10PE.cfg

Maps the drive and proceeds with commands as fast as is possible :thumbsup:

« Last Edit: January 16, 2019, 06:28:05 AM by bob.omb »

Re: PXE Boot for SE and XPE projects
« Reply #11 on: June 26, 2019, 11:37:45 AM »
  • Location: Israel
  • Date Registered: Dec 2017
  • Posts: 444
@bob.omb

Testing with XPE and pin to taskbar is working but no desktop shortcuts are showing.

Re: PXE Boot for SE and XPE projects
« Reply #12 on: June 29, 2019, 08:13:32 PM »

bob.omb

  • Code Baker
  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 1261
Haven't looked at this in a while I have to work on SE right now but when I get a chance I'll look.

Re: PXE Boot for SE and XPE projects
« Reply #13 on: June 29, 2019, 08:19:01 PM »
  • Location: Israel
  • Date Registered: Dec 2017
  • Posts: 444
Haven't looked at this in a while I have to work on SE right now but when I get a chance I'll look.

Take all the time you need

 

Powered by EzPortal