From 6f6eba695907452e8d195a1063247ed139e2f4e8 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 29 Jul 2025 21:08:56 +0200 Subject: [PATCH] Fix content upload at powershell 7.4+ --- Extensions/IntuneAppManagement.psm1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Extensions/IntuneAppManagement.psm1 b/Extensions/IntuneAppManagement.psm1 index 966fcf9..ef4b2fa 100644 --- a/Extensions/IntuneAppManagement.psm1 +++ b/Extensions/IntuneAppManagement.psm1 @@ -521,6 +521,13 @@ function Write-AzureStorageChunk "Content-Type" = "application/octet-stream" } + # In PowerShell (Core) 7 v7.4+, the web cmdlets (Invoke-WebRequest, Invoke-RestMethod) + # consistently encode text-based request bodies as UTF-8, unless explicitly specified otherwise. + if ($PSVersionTable.PSVersion -ge [Version]"7.4") + { + $headers["Content-Type"] += "; charset=iso-8859-1" + } + $curProgressPreference = $ProgressPreference $ProgressPreference = 'SilentlyContinue'