Skip to content

Commit 48fe949

Browse files
committed
[PE Helper/PXE Helpers] Add network adapter install screen, add FOG Helper
1 parent 082d920 commit 48fe949

File tree

4 files changed

+937
-69
lines changed

4 files changed

+937
-69
lines changed

Helpers/extps1/PE_Helper/PE_Helper.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function Start-PEGeneration
8686
$architecture = [PE_Arch]::($arch)
8787
$version = "0.7.1"
8888
Write-Host "DISMTools $version - Preinstallation Environment Helper"
89-
Write-Host "(c) 2024-2025. CodingWonders Software"
89+
Write-Host "(c) 2024-2025. CodingWonders Software. Portions (c) CT Tech Group LLC; (c) JJ Fullmer"
9090
Write-Host "-----------------------------------------------------------"
9191
# Start PE generation
9292
Write-Host "Starting PE generation..."
@@ -1927,7 +1927,7 @@ function Start-ProjectDevelopment {
19271927
$version = "0.7.1"
19281928
$ESVer = "0.6.1"
19291929
Write-Host "DISMTools $version - Preinstallation Environment Helper"
1930-
Write-Host "(c) 2024-2025. CodingWonders Software"
1930+
Write-Host "(c) 2024-2025. CodingWonders Software. Portions (c) CT Tech Group LLC; (c) JJ Fullmer"
19311931
Write-Host "-----------------------------------------------------------"
19321932
# Start PE generation
19331933
Write-Host "Starting project creation... (Extensibility Suite version $ESVer)"

Helpers/extps1/PE_Helper/pxehelpers/PXEHelpers.Startup.ps1

Lines changed: 126 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,106 @@ using namespace System.Collections.Generic
55

66
. "$PSScriptRoot\Common\PXEHelpers.Common.ps1"
77

8+
$networkAdapters = $null
9+
10+
function Get-SystemArchitecture
11+
{
12+
# Detect CPU architecture and compare with list
13+
switch (((Get-CimInstance -Class Win32_Processor | Where-Object { $_.DeviceID -eq "CPU0" }).Architecture).ToString())
14+
{
15+
"0"{
16+
return "i386"
17+
}
18+
"1"{
19+
return "mips"
20+
}
21+
"2"{
22+
return "alpha"
23+
}
24+
"3"{
25+
return "powerpc"
26+
}
27+
"5"{
28+
return "arm"
29+
}
30+
"6"{
31+
return "ia64"
32+
}
33+
"9"{
34+
return "amd64"
35+
}
36+
"12" {
37+
return "aarch64"
38+
}
39+
default {
40+
return ""
41+
}
42+
}
43+
return ""
44+
}
45+
46+
function Show-InstallNetAdapterScreen {
47+
param(
48+
[switch]$firstStartup = $false
49+
)
50+
51+
Show-SectionMessage -sectionTitle "Install a network adapter" -sectionDescription "Either no network adapters were detected on your computer or you decided to install a new network adapter."
52+
53+
Write-Host " The following network adapters were detected on your computer, excluding kernel debuggers:`n"
54+
55+
foreach ($networkAdapter in $networkAdapters) {
56+
Write-Host " - Device ID $($networkAdapter.DeviceID): $($networkAdapter.Name). Type: $($networkAdapter.AdapterType). Service Name: $($networkAdapter.ServiceName)"
57+
}
58+
59+
Write-Host ""
60+
Write-Host " To launch the Driver Installation Module to install a new network adapter, and then go back to the previous screen, type `"DIM`" and press ENTER."
61+
62+
if ($firstStartup) {
63+
Write-Host " To cancel network installation and restart your computer, type `"R`" and press ENTER."
64+
} else {
65+
Write-Host " To go back to the previous screen, type `"X`" and press ENTER."
66+
}
67+
68+
Write-Host ""
69+
$option = Read-Host -Prompt "Choose an option described above and press ENTER"
70+
71+
if ($option -eq "DIM") {
72+
# Get CPU architecture and launch Driver Installation Module
73+
$supportedArchitectures = [List[string]]::new()
74+
$supportedArchitectures.Add("i386")
75+
$supportedArchitectures.Add("amd64")
76+
$supportedArchitectures.Add("aarch64")
77+
$systemArchitecture = Get-SystemArchitecture
78+
79+
if ($supportedArchitectures.Contains($systemArchitecture))
80+
{
81+
if (Test-Path -Path "$env:SYSTEMDRIVE\Tools\DIM\$systemArchitecture\DT-DIM.exe")
82+
{
83+
Clear-Host
84+
Show-CenteredTextBox -Text "Starting the Driver Installation Module . . ." -MaxWidth 70 -CenterOfAll
85+
Start-Process -FilePath "$env:SYSTEMDRIVE\Tools\DIM\$systemArchitecture\DT-DIM.exe" -Wait
86+
Show-CenteredTextBox -Text "Getting Installed Network Adapters . . ." -MaxWidth 70 -CenterOfAll
87+
}
88+
}
89+
} else {
90+
if ($firstStartup) {
91+
wpeutil reboot
92+
}
93+
}
94+
}
95+
896
$host.UI.RawUI.WindowTitle = "Preboot eXecution Environment Helpers"
97+
$global:product = "Preboot eXecution Environment Helpers"
98+
99+
Show-CenteredTextBox -Text "Preboot eXecution Environment Helpers. (c) 2025 CodingWonders Software" -MaxWidth 70 -CenterOfAll
100+
Write-Host "`n Portions (c) CT Tech Group LLC; (c) JJ Fullmer"
101+
102+
Write-Progress -Activity "PXE Helpers starting up..." -Status "Getting network adapters in the system..." -PercentComplete 0
103+
$networkAdapters = Get-CimInstance Win32_NetworkAdapter | Where-Object { $_.ServiceName -ne "kdnic" } # there's no reason to add a kernel debugger to the network adapters list
104+
105+
if (($networkAdapters | Select-Object -ExpandProperty DeviceID).Count -lt 1) {
106+
Show-InstallNetAdapterScreen -firstStartup
107+
}
9108

10109
class PxeHelperProvider {
11110
[string]$ProviderName
@@ -25,9 +124,13 @@ class PxeHelperProvider {
25124
}
26125
}
27126

127+
Show-CenteredTextBox -Text "Preboot eXecution Environment Helpers. (c) 2025 CodingWonders Software" -MaxWidth 70 -CenterOfAll
128+
Write-Host "`n Portions (c) CT Tech Group LLC; (c) JJ Fullmer"
129+
Write-Progress -Activity "PXE Helpers starting up..." -Status "Loading PXE Helper providers..." -PercentComplete 50
130+
28131
$providerList = [List[PxeHelperProvider]]::new()
29132
$providerList.Add([PxeHelperProvider]::new("Windows Deployment Services Helper", "Select this provider to deploy a Windows image using a WDS server.", "0.7+", "wds\wdshelper.ps1", $true, ""))
30-
#$providerList.Add([PxeHelperProvider]::new("FOG Helper", "Select this provider to deploy a Windows image using a FOG server.", "0.7.1+", "fog\foghelper.ps1", $true, "This provider is divided into 2 stages: a Windows stage and a Linux stage."))
133+
$providerList.Add([PxeHelperProvider]::new("FOG Helper", "Select this provider to deploy a Windows image using a FOG server.", "0.7.1+", "fog\foghelper.ps1", $true, "This provider is divided into 2 stages: a Windows stage and a Linux stage."))
31134

32135
function Invoke-PxeProvider {
33136
param (
@@ -36,6 +139,7 @@ function Invoke-PxeProvider {
36139

37140
if (($index -lt 0) -or ($index -gt $($providerList.Count - 1))) {
38141
Write-Host "Please write appropriate data !"
142+
return
39143
}
40144

41145
try {
@@ -46,6 +150,9 @@ function Invoke-PxeProvider {
46150
}
47151
}
48152

153+
Start-Sleep -Milliseconds 500
154+
Write-Progress -Activity "PXE Helpers starting up..." -Status "Initialization Complete" -PercentComplete 100
155+
49156
function Show-PxeProviders {
50157
$idx = 1
51158
foreach ($provider in $providerList) {
@@ -84,18 +191,33 @@ function Show-PxeProviders {
84191
Write-Host ""
85192
}
86193
Write-Host ""
87-
}
88194

89-
$global:product = "Preboot eXecution Environment Helpers"
195+
# Show additional options
196+
Write-Host " N. Install a Network Adapter"
197+
Write-Host " Choose this option to install a new network adapter on this environment. You will go back to this screen afterwards"
198+
Write-Host ""
199+
}
90200

201+
Write-Progress -Activity "PXE Helpers starting up..." -Completed
91202
Show-SectionMessage -sectionTitle "Choose your provider" -sectionDescription "Choose the helper for the PXE provider you use."
92203

93204
if ($providerList.Count -gt 0) {
94205
Show-PxeProviders
95206
$validated = $false
96207
$util = -1
97208
do {
98-
$utilStr = Read-Host -Prompt "Choose an utility from the list above and press ENTER"
209+
$utilStr = Read-Host -Prompt "Choose a utility from the list above and press ENTER"
210+
211+
if ($utilStr -eq "N") {
212+
Show-InstallNetAdapterScreen
213+
214+
Show-SectionMessage -sectionTitle "Choose your provider" -sectionDescription "Choose the helper for the PXE provider you use."
215+
Show-PxeProviders
216+
$validated = $false
217+
$util = -1
218+
219+
continue
220+
}
99221

100222
try {
101223
$util = [int]$utilStr

0 commit comments

Comments
 (0)