Skip to content

Commit 55b7af9

Browse files
committed
[PE Helper] Improvements, lots of improvements
- Add SecureStartup and EnhancedStorage OCs to PE images, mainly to deal with BitLocker-encrypted drives - Improved output of package addition and OC copy
1 parent 30ed38f commit 55b7af9

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

Helpers/extps1/PE_Helper/PE_Helper.ps1

+24-9
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,22 @@ function Start-PEGeneration
176176
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-PowerShell_en-us.cab")
177177
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-DismCmdlets.cab")
178178
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-DismCmdlets_en-us.cab")
179+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-SecureStartup.cab")
180+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-SecureStartup_en-us.cab")
181+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\WinPE-EnhancedStorage.cab")
182+
$pkgs.Add("$((Get-Location).Path)\ISOTEMP\OCs\en-US\WinPE-EnhancedStorage_en-us.cab")
183+
$pkgCount = $pkgs.Count
184+
$curPkgIndex = 0
179185
foreach ($pkg in $pkgs)
180186
{
187+
$curPkgIndex = $pkgs.IndexOf($pkg)
188+
Write-Progress -Activity "Adding OS packages..." -Status "Adding OS package $($curPkgIndex + 1) of $($pkgCount): `"$([IO.Path]::GetFileNameWithoutExtension($pkg))`"..." -PercentComplete (($curPkgIndex / $pkgCount) * 100)
181189
if (Test-Path $pkg -PathType Leaf)
182190
{
183-
Write-Host "Adding OS package $([IO.Path]::GetFileNameWithoutExtension($pkg))..."
184191
Start-DismCommand -Verb Add-Package -ImagePath "$mountDirectory" -PackagePath $pkg | Out-Null
185192
}
186193
}
194+
Write-Progress -Activity "Adding OS packages..." -Completed
187195
Write-Host "Saving changes..."
188196
Start-DismCommand -Verb Commit -ImagePath "$mountDirectory" | Out-Null
189197
# Perform customization tasks later
@@ -422,20 +430,27 @@ function Copy-PEComponents
422430
$loc_OCs = Get-ChildItem -Path "$peToolsPath\$($architecture.ToString())\WinPE_OCs\en-US" -File
423431
$copied = 0
424432
$totalSize = 1
433+
434+
$OC_Count = $general_OCs.Count
435+
$OC_CurrentIndex = 0
425436
foreach ($file in $general_OCs)
426437
{
427-
Copy-Item -Path "$peToolsPath\$($architecture.ToString())\WinPE_OCs\$($file.Name)" -Destination "$targetDir\OCs" -Force -Container -PassThru -Verbose | ForEach-Object {
428-
$copied = ($_.BytesTransferred / $totalSize) * 100
429-
Write-Debug $copied
430-
}
438+
$OC_CurrentIndex = $general_OCs.IndexOf($file)
439+
Write-Progress -Activity "Copying language-neutral Optional Components..." -Status "Copying Optional Component package $($OC_CurrentIndex + 1) of $($OC_Count)..." -PercentComplete (($OC_CurrentIndex / $OC_Count) * 100)
440+
Copy-Item -Path "$peToolsPath\$($architecture.ToString())\WinPE_OCs\$($file.Name)" -Destination "$targetDir\OCs" -Force
431441
}
442+
Write-Progress -Activity "Copying language-neutral Optional Components..." -Completed
443+
444+
# Reset counters and begin counting again
445+
$OC_Count = $loc_OCs.Count
446+
$OC_CurrentIndex = 0
432447
foreach ($file in $loc_OCs)
433448
{
434-
Copy-Item -Path "$peToolsPath\$($architecture.ToString())\WinPE_OCs\en-US\$($file.Name)" -Destination "$targetDir\OCs\en-US" -Force -Container -PassThru -Verbose | ForEach-Object {
435-
$copied = ($_.BytesTransferred / $totalSize) * 100
436-
Write-Debug $copied
437-
}
449+
$OC_CurrentIndex = $loc_OCs.IndexOf($file)
450+
Write-Progress -Activity "Copying language-specific Optional Components..." -Status "Copying Optional Component package $($OC_CurrentIndex + 1) of $($OC_Count) for English (United States)..." -PercentComplete (($OC_CurrentIndex / $OC_Count) * 100)
451+
Copy-Item -Path "$peToolsPath\$($architecture.ToString())\WinPE_OCs\en-US\$($file.Name)" -Destination "$targetDir\OCs\en-US" -Force
438452
}
453+
Write-Progress -Activity "Copying language-specific Optional Components..." -Completed
439454
Write-Host "PE components have been copied successfully."
440455
return $true
441456
}

0 commit comments

Comments
 (0)