Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WinPE reboot when using script
2019-01-22, 08:05 (This post was last modified: 2019-01-22 08:55 by geri005.)
Post: #1
WinPE reboot when using script
Hey guys!

Using iPXE I'm able to boot to WinPE, mount my network drive and install Windows just fine.

However, I wanted to automount my network share, and start setup.exe automatically.

This is how my boot.ipxe looks like:

Code:
#!ipxe

  kernel wimboot
  initrd install.bat install.bat
  initrd winpeshl.ini winpeshl.ini
  initrd bootmgr bootmgr
  initrd boot/BCD         BCD
  initrd boot/boot.sdi    boot.sdi
  initrd sources/boot.wim boot.wim
  boot

And this is the install.bat:
Code:
wpeinit
net use \\192.168.1.99\SZERVER /user:myuser mypwd
\\192.168.1.99\SZERVER\iso\setup.exe

And finally the winpeshl.ini:
Code:
[LaunchApps]
  "install.bat"

Using this, WinPE boots up, then right after wpeinit, it reboots the computer.

What am I doing wrong here? Any help is much appreciated.
Find all posts by this user
Quote this message in a reply
2019-01-22, 08:41
Post: #2
RE: WinPE reboot when using script
1. don't add bootmgr via initrd - let wimboot extract it from the .wim file
2. Have you modified boot.wim in any way, especially, have you added any drivers to it? - if yes my first suspect would be broken drivers, retry with a clean boot.wim
3. In valid format, have you tried without adding winpeshl.ini and see what happens?

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2019-01-22, 08:57 (This post was last modified: 2019-01-22 09:08 by geri005.)
Post: #3
RE: WinPE reboot when using script
(2019-01-22 08:41)NiKiZe Wrote:  1. don't add bootmgr via initrd - let wimboot extract it from the .wim file
2. Have you modified boot.wim in any way, especially, have you added any drivers to it? - if yes my first suspect would be broken drivers, retry with a clean boot.wim
3. In valid format, have you tried without adding winpeshl.ini and see what happens?

1. If I don't add bootmgr, I get a bad CPIO magic error.
2. Nope, fresh download, no modifications.
3. Without winpeshl it doesn't reboot, but of course my commands are not being executed.
Find all posts by this user
Quote this message in a reply
2019-01-22, 10:59
Post: #4
RE: WinPE reboot when using script
So if you run your commands manually, does it work? what if you run the cmd file?
does your .cmd file have proper lineendings?

You should probably investigate your CPIO issue, but hopefully not related to this.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2019-01-22, 11:12
Post: #5
RE: WinPE reboot when using script
(2019-01-22 10:59)NiKiZe Wrote:  So if you run your commands manually, does it work? what if you run the cmd file?
does your .cmd file have proper lineendings?

You should probably investigate your CPIO issue, but hopefully not related to this.

If I run it manually, it works perfectly fine.

I tried a Windows 10 installer boot.wim before, that booted up without bootmgr, but PE refuses...
Find all posts by this user
Quote this message in a reply
2019-02-10, 23:26
Post: #6
RE: WinPE reboot when using script
Check your batch file, most likely the network stack hasn't loaded. Try this instead. Once scripts finish executing from winpeshl.ini, Windows PE automatically reboots. Overwrite startnet.cmd instead if you want to leave the command prompt open.
Find all posts by this user
Quote this message in a reply
2020-09-22, 18:56
Post: #7
RE: WinPE reboot when using script
I had the same problem, my solution:

Add powershell cab to boot.wim:

https://docs.microsoft.com/nl-nl/windows...windows-pe

winpeshl.ini
Code:
[LaunchApps]
wpeinit
powershell, -NoLogo -NoExit -ExecutionPolicy Bypass -File .\startup.ps1

and

startup.ps1
Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'

Start-Sleep -s 15

CMD /C VER

net use s: \\192.168.2.13\boot password /user:boot

Write-Output (Get-Date)

Start-Sleep -s 15

Start-Process -FilePath "S:\iso\windows10\setup.exe" -Wait

boot.wim = new created with powershell!
boot.ipxe
Code:
:winpe_win10

  cpuid --ext 29 && set arch amd64 || set arch x86

  kernel http://${ipxe_server_ip}/ipxe/wimboot
  initrd http://${ipxe_server_ip}/boot/win10/winpeshl.ini                                        winpeshl.ini
  initrd http://${ipxe_server_ip}/boot/win10/startup.ps1                                         startup.ps1
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/BCD               BCD
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/boot.sdi          boot.sdi
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/sources/boot.wim       boot.wim
Find all posts by this user
Quote this message in a reply
2020-09-22, 18:57
Post: #8
RE: WinPE reboot when using script
I had the same problem, my solution:

Add powershell cab to boot.wim:

https://docs.microsoft.com/nl-nl/windows...windows-pe

winpeshl.ini
Code:
[LaunchApps]
wpeinit
powershell, -NoLogo -NoExit -ExecutionPolicy Bypass -File .\startup.ps1

and

startup.ps1
Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'

Start-Sleep -s 15

CMD /C VER

net use s: \\192.168.2.13\boot password /user:boot

Write-Output (Get-Date)

Start-Sleep -s 15

Start-Process -FilePath "S:\iso\windows10\setup.exe" -Wait

boot.wim = new created with powershell!
boot.ipxe
Code:
:winpe_win10

  cpuid --ext 29 && set arch amd64 || set arch x86

  kernel http://${ipxe_server_ip}/ipxe/wimboot
  initrd http://${ipxe_server_ip}/boot/win10/winpeshl.ini                                        winpeshl.ini
  initrd http://${ipxe_server_ip}/boot/win10/startup.ps1                                         startup.ps1
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/BCD               BCD
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/boot.sdi          boot.sdi
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/sources/boot.wim       boot.wim
Find all posts by this user
Quote this message in a reply
2020-09-22, 18:57
Post: #9
RE: WinPE reboot when using script
I had the same problem, my solution:

Add powershell cab to boot.wim:

https://docs.microsoft.com/nl-nl/windows...windows-pe

winpeshl.ini
Code:
[LaunchApps]
wpeinit
powershell, -NoLogo -NoExit -ExecutionPolicy Bypass -File .\startup.ps1

and

startup.ps1
Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'

Start-Sleep -s 15

CMD /C VER

net use s: \\192.168.2.13\boot password /user:boot

Write-Output (Get-Date)

Start-Sleep -s 15

Start-Process -FilePath "S:\iso\windows10\setup.exe" -Wait

boot.wim = new created with powershell!
boot.ipxe
Code:
:winpe_win10

  cpuid --ext 29 && set arch amd64 || set arch x86

  kernel http://${ipxe_server_ip}/ipxe/wimboot
  initrd http://${ipxe_server_ip}/boot/win10/winpeshl.ini                                        winpeshl.ini
  initrd http://${ipxe_server_ip}/boot/win10/startup.ps1                                         startup.ps1
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/BCD               BCD
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/boot.sdi          boot.sdi
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/sources/boot.wim       boot.wim
Find all posts by this user
Quote this message in a reply
2020-09-22, 18:57
Post: #10
RE: WinPE reboot when using script
I had the same problem, my solution:

Add powershell cab to boot.wim:

https://docs.microsoft.com/nl-nl/windows...windows-pe

winpeshl.ini
Code:
[LaunchApps]
wpeinit
powershell, -NoLogo -NoExit -ExecutionPolicy Bypass -File .\startup.ps1

and

startup.ps1
Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'

Start-Sleep -s 15

CMD /C VER

net use s: \\192.168.2.13\boot password /user:boot

Write-Output (Get-Date)

Start-Sleep -s 15

Start-Process -FilePath "S:\iso\windows10\setup.exe" -Wait

boot.wim = new created with powershell!
boot.ipxe
Code:
:winpe_win10

  cpuid --ext 29 && set arch amd64 || set arch x86

  kernel http://${ipxe_server_ip}/ipxe/wimboot
  initrd http://${ipxe_server_ip}/boot/win10/winpeshl.ini                                        winpeshl.ini
  initrd http://${ipxe_server_ip}/boot/win10/startup.ps1                                         startup.ps1
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/BCD               BCD
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/Boot/boot.sdi          boot.sdi
  initrd http://${ipxe_server_ip}/iso/extracted/clean/winpe/${arch}/media/sources/boot.wim       boot.wim
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 6 Guest(s)