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

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.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...