From 10624787fe6b98416659691c47a67aaf17fc4437 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:39:49 -0800 Subject: [PATCH] Fix ODT - Refactored the Get-ODTURL function to fix recent download issues. Also added some better error handling - Moved the odtsetup.exe download to the FFUDevelopment folder and will clean it up after office has downloaded --- FFUDevelopment/BuildFFUVM.ps1 | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 1e42dd5..961e4ba 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -1775,21 +1775,36 @@ function Get-WindowsESD { function Get-ODTURL { + try { + [String]$ODTPage = Invoke-WebRequest 'https://www.microsoft.com/en-us/download/details.aspx?id=49117' -Headers $Headers -UserAgent $UserAgent -ErrorAction Stop - # [String]$MSWebPage = Invoke-RestMethod 'https://www.microsoft.com/en-us/download/confirmation.aspx?id=49117' - [String]$MSWebPage = Invoke-RestMethod 'https://www.microsoft.com/en-us/download/confirmation.aspx?id=49117' -Headers $Headers -UserAgent $UserAgent - - $MSWebPage | ForEach-Object { - if ($_ -match 'url=(https://.*officedeploymenttool.*\.exe)') { - $matches[1] + # Extract JSON data from the webpage + if ($ODTPage -match '