@@ -176,14 +176,22 @@ function Start-PEGeneration
176
176
$pkgs.Add (" $ ( (Get-Location ).Path) \ISOTEMP\OCs\en-US\WinPE-PowerShell_en-us.cab" )
177
177
$pkgs.Add (" $ ( (Get-Location ).Path) \ISOTEMP\OCs\WinPE-DismCmdlets.cab" )
178
178
$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
179
185
foreach ($pkg in $pkgs )
180
186
{
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 )
181
189
if (Test-Path $pkg - PathType Leaf)
182
190
{
183
- Write-Host " Adding OS package $ ( [IO.Path ]::GetFileNameWithoutExtension($pkg )) ..."
184
191
Start-DismCommand - Verb Add-Package - ImagePath " $mountDirectory " - PackagePath $pkg | Out-Null
185
192
}
186
193
}
194
+ Write-Progress - Activity " Adding OS packages..." - Completed
187
195
Write-Host " Saving changes..."
188
196
Start-DismCommand - Verb Commit - ImagePath " $mountDirectory " | Out-Null
189
197
# Perform customization tasks later
@@ -422,20 +430,27 @@ function Copy-PEComponents
422
430
$loc_OCs = Get-ChildItem - Path " $peToolsPath \$ ( $architecture.ToString ()) \WinPE_OCs\en-US" - File
423
431
$copied = 0
424
432
$totalSize = 1
433
+
434
+ $OC_Count = $general_OCs.Count
435
+ $OC_CurrentIndex = 0
425
436
foreach ($file in $general_OCs )
426
437
{
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
431
441
}
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
432
447
foreach ($file in $loc_OCs )
433
448
{
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
438
452
}
453
+ Write-Progress - Activity " Copying language-specific Optional Components..." - Completed
439
454
Write-Host " PE components have been copied successfully."
440
455
return $true
441
456
}
0 commit comments