Merge pull request #35 from mhaley/patch-1

Assign drive letter to recovery partition before modification
This commit is contained in:
rbalsleyMSFT
2024-07-09 09:28:30 -07:00
committed by GitHub
@@ -495,10 +495,12 @@ $WinRE = $USBDrive + "WinRE\winre.wim"
If (Test-Path -Path $WinRE)
{
WriteLog 'Copying modified WinRE to Recovery directory'
Get-Disk | Where-Object Number -eq $DiskID | Get-Partition | Where-Object Type -eq Recovery | Set-Partition -NewDriveLetter R
Invoke-Process xcopy.exe "/h $WinRE R:\Recovery\WindowsRE\ /Y"
WriteLog 'Copying WinRE to Recovery directory succeeded'
WriteLog 'Registering location of recovery tools'
Invoke-Process W:\Windows\System32\Reagentc.exe "/Setreimage /Path R:\Recovery\WindowsRE /Target W:\Windows"
Get-Disk | Where-Object Number -eq $DiskID | Get-Partition | Where-Object Type -eq Recovery | Remove-PartitionAccessPath -AccessPath R:
WriteLog 'Registering location of recovery tools succeeded'
}
# else