Skip to content

Commit 09b7e43

Browse files
DISMTools 0.7.2 Preview 4 (#312)
* Update assembly information * [PE Helper/PXE Helpers/FOGHS] Add UNIX usage notes * [PE Helper/PXE Helpers] Add menu items for Server components * [PE Helper/PXE Helpers/FOGHS] Detect fog and mariadb systemd service units * [ISO Creator] Detect Windows UEFI CA 2023 DBX cert on current system * [ISO Creator] Skip checks on BIOS systems * [ISO Creator] Do not show DBX warning on UEFI systems without Secure Boot * [Unattended answer file] For starter scripts in browser, correctly detect language * [PMIP] Show in the center by default * [PE Helper] Update HotInstall and Sysprep Preparator binaries * [PE Helper] Add option to launch DIM on image capture script * [Lib] Update Scintilla.NET to 6.1.1 * [Unattended answer file] Add auto-edition button for product keys * [PE Helper/PXE Helpers/WDSHC] Warn when loaded on non-PXE environment * [Fix] Automatically close web-enabled forms on closure * [Fix] Do not download updater if it can't be deleted * [PE Helper/PXE Helpers/WDSHC] Automatically get WDS server IP address * [PE Helper/PXE Helpers/WDSHC] Validate more server auth input * [PE Helper] Add support for WDS tools * [PE Helper] Allow image capture script to load WDS image capture wizard * [PE Helper] Remove DT PE BCD entry after WDS capture completes * [PE Helper] Create custom wdscapture config list file to exclude DT folders * [Unattended answer file] Update UnattendGen * [Unattended answer file] Show message when no matches are found * [PE Helper] Do not show WDS option if WDSCAPTURE does not exist * [Fix] Add AdkInstallation value regardless of what function returns * [Unattended answer file] Default to new message on script creation * [Fix] Close another form before closing application * [Refactor] Refactor ADK detection This change makes ADK detection more reliable across the program and in the PE Helper. Thanks rayman95 on the MDL forums * [PE Helper] Fix issues with ADK detection if kits root is only on WOW6432Node * [REL] Update What's New section
1 parent 5796cf3 commit 09b7e43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1613
-973
lines changed

DISMTools.vbproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
<Reference Include="PresentationFramework">
108108
<Private>True</Private>
109109
</Reference>
110-
<Reference Include="Scintilla.NET, Version=6.1.0.0, Culture=neutral, PublicKeyToken=0221e70ba618311e, processorArchitecture=MSIL">
111-
<HintPath>packages\Scintilla5.NET.6.1.0\lib\net462\Scintilla.NET.dll</HintPath>
110+
<Reference Include="Scintilla.NET, Version=6.1.1.0, Culture=neutral, PublicKeyToken=0221e70ba618311e, processorArchitecture=MSIL">
111+
<HintPath>packages\Scintilla5.NET.6.1.1\lib\net462\Scintilla.NET.dll</HintPath>
112112
</Reference>
113113
<Reference Include="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
114114
<Private>True</Private>
@@ -1544,6 +1544,9 @@
15441544
<Content Include="Helpers\extps1\PE_Helper\files\README1ST.TXT">
15451545
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
15461546
</Content>
1547+
<Content Include="Helpers\extps1\PE_Helper\pxehelpers\fog\foghs_unix_notes.txt">
1548+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1549+
</Content>
15471550
<Content Include="Helpers\extps1\PE_Helper\tools\DIM\aarch64\DT-DIM.exe">
15481551
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
15491552
</Content>
@@ -2139,11 +2142,11 @@ IF EXIST "report.html" (del "report.html")</PreBuildEvent>
21392142
<Target Name="AfterBuild">
21402143
</Target>
21412144
-->
2142-
<Import Project="packages\Scintilla5.NET.6.1.0\build\scintilla5.net.targets" Condition="Exists('packages\Scintilla5.NET.6.1.0\build\scintilla5.net.targets')" />
2145+
<Import Project="packages\Scintilla5.NET.6.1.1\build\scintilla5.net.targets" Condition="Exists('packages\Scintilla5.NET.6.1.1\build\scintilla5.net.targets')" />
21432146
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
21442147
<PropertyGroup>
21452148
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
21462149
</PropertyGroup>
2147-
<Error Condition="!Exists('packages\Scintilla5.NET.6.1.0\build\scintilla5.net.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Scintilla5.NET.6.1.0\build\scintilla5.net.targets'))" />
2150+
<Error Condition="!Exists('packages\Scintilla5.NET.6.1.1\build\scintilla5.net.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Scintilla5.NET.6.1.1\build\scintilla5.net.targets'))" />
21482151
</Target>
21492152
</Project>

Helpers/extps1/PE_Helper/PE_Helper.ps1

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,50 @@ if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]:
7777
exit 1
7878
}
7979

80+
function Get-KitsRoot {
81+
param (
82+
[Parameter(Mandatory = $true, Position = 0)] [bool]$wow64environment
83+
)
84+
85+
$adk10KitsRoot = ""
86+
87+
# if we set the wow64 bit on and we're on a 32-bit system, then we prematurely return the value
88+
if (($wow64environment -eq $true) -and (-not [Environment]::Is64BitOperatingSystem)) {
89+
return $adk10KitsRoot
90+
}
91+
92+
$regPath = ""
93+
if ($wow64environment) {
94+
$regPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots"
95+
} else {
96+
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots"
97+
}
98+
99+
if ((Test-Path "$regPath") -eq $false) {
100+
return $adk10KitsRoot
101+
}
102+
103+
try {
104+
$adk10KitsRoot = Get-ItemPropertyValue -Path $regPath -Name "KitsRoot10" -ErrorAction Stop
105+
} catch {
106+
Write-Host "Could not find ADK."
107+
}
108+
109+
return $adk10KitsRoot
110+
}
111+
112+
function Test-KitsRootPaths {
113+
param (
114+
[Parameter(Mandatory = $true, Position = 0)] [string]$adkKitsRootPath,
115+
[Parameter(Mandatory = $true, Position = 1)] [string]$adkKitsRootPath_WOW64Environ
116+
)
117+
118+
if (Test-Path "$adkKitsRootPath") { return $true }
119+
if (Test-Path "$adkKitsRootPath_WOW64Environ") { return $true }
120+
121+
return $false
122+
}
123+
80124
function Start-PEGeneration
81125
{
82126
<#
@@ -94,24 +138,26 @@ function Start-PEGeneration
94138
# Detect if the Windows ADK is present
95139
try
96140
{
97-
if ((Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\WIMMount' -Name 'AdkInstallation') -eq 1)
141+
# RAYMAN prompted the change. YEAH!
142+
$adkKitsRoot = Get-KitsRoot -wow64environment $false
143+
$adkKitsRoot_WOW64Environ = Get-KitsRoot -wow64environment $true
144+
145+
$expectedADKPath = "$($adkKitsRoot)Assessment and Deployment Kit"
146+
$expectedADKPath_WOW64Environ = "$($adkKitsRoot_WOW64Environ)Assessment and Deployment Kit"
147+
148+
if ((Test-KitsRootPaths -adkKitsRootPath "$expectedADKPath" -adkKitsRootPath_WOW64Environ "$expectedADKPath_WOW64Environ") -eq $true)
98149
{
99-
# An ADK may be installed, but it may not be Windows 10 ADK
100-
$progFiles = ""
101150
$peToolsPath = ""
102-
if ([Environment]::Is64BitOperatingSystem)
103-
{
104-
$progFiles = "$env:SYSTEMDRIVE\Program Files (x86)"
105-
}
106-
else
107-
{
108-
$progFiles = "$env:SYSTEMDRIVE\Program Files"
109-
}
110-
if (Test-Path "$progFiles\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment")
151+
152+
if ($expectedADKPath -ne "Assessment and Deployment Kit") { $peToolsPath = $expectedADKPath }
153+
if (($peToolsPath -eq "") -and ($expectedADKPath_WOW64Environ -ne "")) { $peToolsPath = $expectedADKPath_WOW64Environ }
154+
155+
if (Test-Path "$peToolsPath")
111156
{
112-
$peToolsPath = "$progFiles\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment"
157+
Write-Host "Using $peToolsPath as the Preinstallation Environment tools path..."
158+
113159
Write-Host "Creating working directory and copying Preinstallation Environment (PE) files..."
114-
if ((Copy-PEFiles -peToolsPath "$progFiles\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment" -architecture $architecture -targetDir "$((Get-Location).Path)\ISOTEMP") -eq $false)
160+
if ((Copy-PEFiles -peToolsPath "$peToolsPath\Windows Preinstallation Environment" -architecture $architecture -targetDir "$((Get-Location).Path)\ISOTEMP") -eq $false)
115161
{
116162
Write-Host "Preinstallation Environment creation has failed in the PE file copy phase."
117163
Write-Host "`nPress ENTER to exit"
@@ -176,7 +222,7 @@ function Start-PEGeneration
176222
Start-DismCommand -Verb Commit -ImagePath "$mountDirectory" | Out-Null
177223
}
178224
Write-Host "Copying Windows PE optional components. Please wait..."
179-
if ((Copy-PEComponents -peToolsPath "$progFiles\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment" -architecture $architecture -targetDir "$((Get-Location).Path)\ISOTEMP") -eq $false)
225+
if ((Copy-PEComponents -peToolsPath "$peToolsPath\Windows Preinstallation Environment" -architecture $architecture -targetDir "$((Get-Location).Path)\ISOTEMP") -eq $false)
180226
{
181227
Write-Host "Preinstallation Environment creation has failed in the PE optional component copy phase."
182228
Write-Host "`nPress ENTER to exit"
@@ -501,6 +547,8 @@ function Add-PEPackages {
501547
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-EnhancedStorage_en-us.cab")
502548
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-StorageWMI.cab")
503549
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-StorageWMI_en-us.cab")
550+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-WDS-Tools.cab")
551+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-WDS-Tools_en-us.cab")
504552
# Add ARM64EC packages
505553
if ($architecture -eq 'arm64') {
506554
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-x64-Support.cab")
@@ -835,11 +883,11 @@ function New-WinPEIso
835883
}
836884
if ([Environment]::Is64BitOperatingSystem)
837885
{
838-
Set-Item -Path "env:NewPath" -Value "$peToolsPath\..\Deployment Tools\amd64\Oscdimg"
886+
Set-Item -Path "env:NewPath" -Value "$peToolsPath\Deployment Tools\amd64\Oscdimg"
839887
}
840888
else
841889
{
842-
Set-Item -Path "env:NewPath" -Value "$peToolsPath\..\Deployment Tools\x86\Oscdimg"
890+
Set-Item -Path "env:NewPath" -Value "$peToolsPath\Deployment Tools\x86\Oscdimg"
843891
}
844892
# Detect whether files are in fwfiles or bootbins - ADK 10.1.26100.2454 and later put boot files in bootbins,
845893
# not in fwfiles. All of this to add support for the boot binaries signed with this certificate - I'm starting to
-130 Bytes
Binary file not shown.
1 Byte
Binary file not shown.

Helpers/extps1/PE_Helper/files/scripts/imagecapture.bat

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
@echo off
2+
set sysdrive=%SYSTEMDRIVE%
3+
4+
:main
25
cls
36
echo Image Capture Utility
47
echo =========================
@@ -11,17 +14,40 @@ echo.
1114
echo Showing drive letter assignments...
1215
set scriptpath=%TEMP%\%RANDOM%.txt
1316
set configlistpath=%TEMP%\configlist.ini
17+
set wdscapturepath=%SYSTEMROOT%\system32\wdscapture.inf
1418

1519
echo lis vol > %scriptpath%
1620
echo exi >> %scriptpath%
1721

1822
diskpart /s %scriptpath%
1923

20-
set /p sourcedrive=Please enter the letter of the volume to capture:
24+
echo.
25+
echo - To install drivers if you don't see your drives, type "DIM"
26+
if exist "%SYSTEMROOT%\system32\wdscapture.exe" ( echo - To prepare a capture for a Windows Deployment Services server, type "WDS" )
27+
echo.
28+
29+
set /p sourcedrive=Please enter the letter of the volume to capture, or option to invoke:
2130
if not defined sourcedrive (
2231
echo The letter of the volume to capture must be specified.
2332
exit /b 1
2433
)
34+
35+
if "%sourcedrive%" equ "DIM" (
36+
call :dt_dim_driver_install
37+
goto :main
38+
)
39+
40+
if "%sourcedrive%" equ "WDS" (
41+
if not exist "%SYSTEMROOT%\system32\wdscapture.exe" ( goto :main )
42+
call :create_wdscapture_config_list
43+
"%SYSTEMROOT%\system32\wdscapture.exe"
44+
if %ERRORLEVEL% equ 0 (
45+
echo WDS capture succeeded.
46+
call :sysprep_hotinstall_remove_temp_files
47+
)
48+
exit /b
49+
)
50+
2551
set /p destdrive=Please enter the letter of the volume the file will be stored on:
2652
if not defined destdrive (
2753
echo The letter of the volume where the image will be stored must be specified.
@@ -73,6 +99,17 @@ echo The capture script was invoked by the Sysprep preparation tool. Removing fi
7399
bcdedit /delete {current} /f
74100
exit /b
75101

102+
:dt_dim_driver_install
103+
echo Starting the Driver Installation Module for architecture %PROCESSOR_ARCHITECTURE%...
104+
if "%PROCESSOR_ARCHITECTURE%" equ "X86" (
105+
"%sysdrive%\Tools\DIM\i386\DT-DIM.exe"
106+
) else if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
107+
"%sysdrive%\Tools\DIM\amd64\DT-DIM.exe"
108+
) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" (
109+
"%sysdrive%\Tools\DIM\aarch64\DT-DIM.exe"
110+
)
111+
exit /b
112+
76113
:create_config_list
77114
echo Setting up file/folder exclusions for source volume...
78115
REM create the config list file. It will call echo lots of times
@@ -98,4 +135,38 @@ echo [CompressionExclusionList] >> %configlistpath%
98135
echo *.mp3 >> %configlistpath%
99136
echo *.zip >> %configlistpath%
100137
echo *.cab >> %configlistpath%
101-
echo \WINDOWS\inf\*.pnf >> %configlistpath%
138+
echo \WINDOWS\inf\*.pnf >> %configlistpath%
139+
exit /b
140+
141+
:create_wdscapture_config_list
142+
echo Preparing wdscapture.inf...
143+
REM we can perform modifications to wdscapture.inf without touching the ACLs.
144+
echo [Capture] > %wdscapturepath%
145+
echo Unattended=No >> %wdscapturepath%
146+
echo VolumeToCapture= >> %wdscapturepath%
147+
echo SystemRoot= >> %wdscapturepath%
148+
echo ImageName= >> %wdscapturepath%
149+
echo ImageDescription= >> %wdscapturepath%
150+
echo DestinationFile= >> %wdscapturepath%
151+
echo Overwrite=No >> %wdscapturepath%
152+
echo. >> %wdscapturepath%
153+
echo [ExclusionList] >> %wdscapturepath%
154+
echo $ntfs.log >> %wdscapturepath%
155+
echo hiberfil.sys >> %wdscapturepath%
156+
echo pagefile.sys >> %wdscapturepath%
157+
echo "System Volume Information" >> %wdscapturepath%
158+
echo RECYCLER >> %wdscapturepath%
159+
echo winpepge.sys >> %wdscapturepath%
160+
echo %%SYSTEMROOT%%\CSC >> %wdscapturepath%
161+
echo $DISMTOOLS.~BT >> %wdscapturepath%
162+
echo $DISMTOOLS.~WS >> %wdscapturepath%
163+
echo. >> %wdscapturepath%
164+
echo [WDS] >> %wdscapturepath%
165+
echo UploadToWDSServer=No >> %wdscapturepath%
166+
echo WDSServerName= >> %wdscapturepath%
167+
echo WDSImageGroup= >> %wdscapturepath%
168+
echo Username= >> %wdscapturepath%
169+
echo Password= >> %wdscapturepath%
170+
echo DeleteLocalWimOnSuccess=No >> %wdscapturepath%
171+
echo. >> %wdscapturepath%
172+
exit /b

Helpers/extps1/PE_Helper/files/start_foghs_unix.sh

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,43 @@ if [[ ! $? ]]; then
1111
echo "PowerShell is not installed. Refer to Microsoft documentation in order to install PowerShell for UNIX."
1212
echo "If you see this message even when PowerShell is installed on your system, please report this issue."
1313
echo ""
14-
echo "Exiting..."
14+
echo "Showing usage instructions and exiting..."
15+
if [[ -f "./pxehelpers/fog/foghs_unix_notes.txt" ]]; then
16+
more ./pxehelpers/fog/foghs_unix_notes.txt
17+
fi
1518
exit 1
1619
fi
1720

1821
if [[ ! -f "$FOGHELPER_SCRIPTPATH" ]]; then
1922
echo "The FOG Helper server component for Unix systems is not available in either the current path or the provided disc."
20-
echo "Exiting..."
23+
echo "Showing usage instructions and exiting..."
24+
if [[ -f "./pxehelpers/fog/foghs_unix_notes.txt" ]]; then
25+
more ./pxehelpers/fog/foghs_unix_notes.txt
26+
fi
2127
exit 2
2228
fi
2329

30+
# get amount of systemd units for both fog and mariadb
31+
FOG_SYSTEMD_UNITS=$(ls -lA /usr/lib/systemd/system/FOG*.service 2>/dev/null | wc -l)
32+
33+
if [[ $FOG_SYSTEMD_UNITS -le 0 ]]; then
34+
echo "No FOG services have been detected on this system."
35+
echo "Showing usage instructions and exiting..."
36+
if [[ -f "./pxehelpers/fog/foghs_unix_notes.txt" ]]; then
37+
more ./pxehelpers/fog/foghs_unix_notes.txt
38+
fi
39+
exit 3
40+
fi
41+
42+
if [[ ! -f "/usr/lib/systemd/system/mariadb.service" ]]; then
43+
echo "MariaDB service has not been detected on this system."
44+
echo "Showing usage instructions and exiting..."
45+
if [[ -f "./pxehelpers/fog/foghs_unix_notes.txt" ]]; then
46+
more ./pxehelpers/fog/foghs_unix_notes.txt
47+
fi
48+
exit 3
49+
fi
50+
2451
echo "You may be asked for your password as starting up the FOG Helper Server requires setting up firewall rules for"
2552
echo "the API listeners and the web server."
2653

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ if ($env:NOFWRULESETUP -ne $null) {
140140
$noFirewallSetup = $true
141141
}
142142

143+
# Detect FOG and MariaDB systemd units
144+
if ((Get-ChildItem -Path "/usr/lib/systemd/system/FOG*.service" -ErrorAction SilentlyContinue).Count -le 0) {
145+
Write-LogMessage -message "FOG systemd service units not detected. FOG service is not installed!"
146+
return $false
147+
}
148+
149+
if ((Test-Path -Path "/usr/lib/systemd/system/mariadb.service" -PathType Leaf) -eq $false) {
150+
Write-LogMessage -message "MariaDB systemd service unit not detected. Database service is not installed!"
151+
return $false
152+
}
153+
143154
if ((Invoke-FogModuleAvailabilityPreparation) -eq $false) {
144155
Write-LogMessage -message "Could not prepare FOG API module. Exiting..."
145156
return $false

0 commit comments

Comments
 (0)