Intune Powershell Scripts – Encoding Gotcha

Written by James McDonald

June 25, 2021

Just had a powershell script that was failing

When I went in to the registry key that stores the results of the script running I saw some corrupted characters

The problem turned out to be I had a file that was encoded in UTF-16LE

So I saved the powershell script as UTF-8 and then deleted the current script and re-uploaded and it worked fine

Write-Host “Running Remove Mail App”
Get-AppxPackage Microsoft.windowscommunicationsapps | Remove-AppxPackage
Write-Host “End Remove Mail App”

And another thing

How to map your Powershell Script registry Output to the corresponding Item in Intune

Open the Powershell script in Intune and check the url note how the registry key GUID corresponds to the URL



Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…