From 8100df3d24b0776335120c95e0182322cfa98ae3 Mon Sep 17 00:00:00 2001 From: Zehadi Alam <63765084+zehadialam@users.noreply.github.com> Date: Tue, 16 Jul 2024 23:43:35 -0400 Subject: [PATCH] Add diskpart commands to assign GPT attributes to recovery partition --- FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 index ec131e6..e3e3a5f 100644 --- a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 +++ b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 @@ -444,6 +444,16 @@ WriteLog "Applying FFU to $PhysicalDeviceID" WriteLog "Running command dism /apply-ffu /ImageFile:$FFUFileToInstall /ApplyDrive:$PhysicalDeviceID" #In order for Applying Image progress bar to show up, need to call dism directly. Might be a better way to handle, but must have progress bar show up on screen. dism /apply-ffu /ImageFile:$FFUFileToInstall /ApplyDrive:$PhysicalDeviceID +$recoveryPartition = Get-Partition -Disk $Disk | Where-Object PartitionNumber -eq 4 +if ($recoveryPartition) { + $diskpartScript = @( + "SELECT DISK $($Disk.Number)", + "SELECT PARTITION $($recoveryPartition.PartitionNumber)", + "GPT ATTRIBUTES=0x8000000000000001", + "EXIT" + ) + $diskpartScript | diskpart.exe +} if($LASTEXITCODE -eq 0){ WriteLog 'Successfully applied FFU' }