KB5034441 Fails. Here's a script from Action1 that can be pushed via your deployment tool of choice (SCCM, PDQ, etc):

https://www.action1.com/fixing-winre-update-issues-for-cve-2024-20666-and-kb5034441/

https://support.microsoft.com/en-us/topic/kb5028997-instructions-to-manually-resize-your-partition-to-install-the-winre-update-400faa27-9343-461c-ada9-24c8229763bf

=========================================
#Gather data from winre
[string]$nfo = reagentc /info
if($nfo -match ".Windows RE status:.Enabled.*"){ #Verify if WINRE is enabled, if so proceed.
$nfo -match ".Windows RE location.harddisk(\d+)" | Out-Null #Locate the disk number it is on.
$disk = $Matches[1]
$nfo -match ".Windows RE location.partition(\d+)" | Out-Null #Locate the partition it is on.
$partition = $Matches[1]
New-Object -TypeName psobject -Property $([ordered]@{Enabled='True';Disk=$disk;Partition=$partition;Resizable=(((Get-Disk -Number $disk | Get-Partition).PartitionNumber | Measure-Object -Maximum).Maximum -eq $partition);CurrentSize=(string.Size / 1MB) +'MB');A1_Key=[System.GUID]::NewGuid()})
}else{
New-Object -TypeName psobject -Property $([ordered]@{Enabled='False';Disk='N/A';Partition='N/A';Resizable='N/A';CurrentSize='N/A';A1_Key=[System.GUID]::NewGuid()})
}

 

=========================================
#Gather data on if this can be done.
[string]$nfo = reagentc /info
if($nfo -match ".Windows RE status:.Enabled.*"){ #Verify if WINRE is enabled, if so proceed.
$nfo -match ".Windows RE location.harddisk(\d+)" | Out-Null #Locate the disk number it is on.
$disk = $Matches[1]
$nfo -match ".Windows RE location.partition(\d+)" | Out-Null #Locate the partition it is on.
$partition = $Matches[1]
$disk_type = $(Get-Disk | Select-Object Number, PartitionStyle | ?{$_.Number -eq 0}).PartitionStyle #Determine disk partition style.

#Start building the script to pass to diskpart.
$Diskpart_Script = "sel disk $disk`n" #Target disk with recovery partition.
$Diskpart_Script += "sel partition $($partition - 1)`n" #Target partition left adjacent to recovery partition.
$Diskpart_Script += "shrink desired=250 minimum=250`n" #Shrink by 250m.
$Diskpart_Script += "sel partition $partition`n" #Target recovery partition.
$Diskpart_Script += "delete partition override`n" #Remove it.
if ($disk_type -eq 'GPT'){ #Recreate partition based on partiton table layout.
$Diskpart_Script += "create partition primary id=de94bba4-06d1-4d40-a16a-bfd50179d6ac`n"
$Diskpart_Script += "gpt attributes=0x8000000000000001`n"
}else{
$Diskpart_Script += "create partition primary id=27`n"
}
$Diskpart_Script += "format fs=ntfs label="Windows RE tools" quick`n" #Format the newly created partition.
$Diskpart_Script | Out-File .\DiskScript.txt -Encoding ascii #Write the script.

#Do it!
reagentc /disable
diskpart /s .\DiskScript.txt
reagentc /enable
Remove-Item .\DiskScript.txt
}