How to diagnose issues with Powershell Scripts Running in Intune

Following on from this great article

The Powershell Script History and logs are stored in the following registry location

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\Policies

You will need to navigate to a subtree in their GUID

How do I get the GUID for my Intune Script?

Diagnosing Failures

A result was coming Failed with the below

��$ : The term '��$' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files (x86)\Microsoft Intune Management
Extension\Policies\Scripts\ee7f18e5-b666-4c11-be72-9d5490a49e23_a39275a0-659c-45a9-9f1a-d312ae484eda.ps1:1 char:1
+ ��$

On running the scripts get copied here briefly then run and deleted : C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts

You have to be fast but you can copy the .ps1 file to e.g. C:\Temp and check what the machine was getting , to resolve this issue I had to recopy the file into Powershell ISE and resave and upload.

 

How to Run the Scripts Manually

Change DownloadCountand ErrorCode to 0 and set Result and ResultDetails to nothing (empty string). After this we just restart the Microsoft Intune Management Extension Service (IntuneManagementExtension) and the script will rerun again on this device

 

Log Directory

C:\ProgramData\Microsoft\IntuneManagementExtension\Logs

 
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 7.50 out of 5)
Loading...