Intune Powershell Scripts – Encoding Gotcha

Just had a powershell script…

Login

Blog History

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

https://endpoint.microsoft.com/?ref=AdminCenter#blade/Microsoft_Intune_DeviceSettings/ConfigureWMPolicyMenu/overview/policyId/0889be91-f8b6-4bd5-9d6b-f5eaed4758fd/policyType/0

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\Policies\b8b0b6fb-1de6-4a57-bc48-6f7367b27b17\0889be91-f8b6-4bd5-9d6b-f5eaed4758fd

0 Comments

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.