Skip to content

Commit cdf65dd

Browse files
committed
[PE Helper] Added guards to prevent running on non-Windows systems
1 parent 82ca2e7 commit cdf65dd

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Helpers/extps1/PE_Helper/PE_Helper.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,12 @@ function Start-ProjectDevelopment {
21212121

21222122
$host.UI.RawUI.WindowTitle = "DISMTools - Preinstallation Environment Helper"
21232123

2124+
if ([Environment]::OSVersion.Platform -ne "Win32NT") {
2125+
Write-Host "This script cannot be run on non-Windows NT platforms. Press ENTER to exit..."
2126+
Read-Host | Out-Null
2127+
exit 1
2128+
}
2129+
21242130
if ($cmd -eq "StartApply")
21252131
{
21262132
Start-OSApplication

Helpers/extps1/PE_Helper/pxehelpers/fog/foghelper_server.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ Write-Host "(c) 2025. CodingWonders Software"
132132
Write-Host "-----------------------------------------------------------"
133133

134134
Write-LogMessage -message "Checking operating environment..."
135+
136+
if ([Environment]::OSVersion.Platform -ne "Win32NT") {
137+
Write-Host "This script cannot be run on non-Windows NT platforms. Press ENTER to exit..."
138+
Read-Host | Out-Null
139+
return $false
140+
}
141+
135142
$compInfo = Get-ComputerInfo
136143
if ($compInfo.WindowsInstallationType -ne "Server") {
137144
Write-LogMessage -message "This computer is not running Windows Server."

Helpers/extps1/PE_Helper/pxehelpers/wds/prepare_wds.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ function New-MulticastTransmission {
628628

629629
Clear-Host
630630

631+
if ([Environment]::OSVersion.Platform -ne "Win32NT") {
632+
Write-Host "This script cannot be run on non-Windows NT platforms. Press ENTER to exit..."
633+
Read-Host | Out-Null
634+
return $false
635+
}
636+
631637
Write-Host "DISMTools $version - PE Helper WDS Preparation Scripts"
632638
Write-Host "(c) 2025. CodingWonders Software"
633639
Write-Host "-----------------------------------------------------------"

Helpers/extps1/PE_Helper/pxehelpers/wds/wdshelper_server.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ Write-Host "(c) 2025. CodingWonders Software"
9393
Write-Host "-----------------------------------------------------------"
9494

9595
Write-LogMessage -message "Checking operating environment..."
96+
97+
if ([Environment]::OSVersion.Platform -ne "Win32NT") {
98+
Write-Host "This script cannot be run on non-Windows NT platforms. Press ENTER to exit..."
99+
Read-Host | Out-Null
100+
return $false
101+
}
102+
96103
$compInfo = Get-ComputerInfo
97104
if ($compInfo.WindowsInstallationType -ne "Server") {
98105
Write-LogMessage -message "This computer is not running Windows Server."

0 commit comments

Comments
 (0)