Intune script fails "Powershell execution has exceeded defined timeout."

X-Box-11-2021 305 Reputation points
2025-03-06T04:04:48.0366667+00:00

Hi All,

The script only takes backup of Outlook signatures and removes them.

Applied the script through Intune.

The device is marked as compliant.

What might be the reason of the script failing with the result "Powershell execution has exceeded defined timeout."

Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
2,020 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ZhoumingDuan-MSFT 16,360 Reputation points Microsoft External Staff
    2025-03-06T07:11:23.63+00:00

    @X-Box-11-2021, Thanks for posting in Q&A.

    From your description, I know you got the error of PowerShell execution has exceeded defined timeout.

    Based on my research, the error means a script takes longer to execute than the maximum time allowed by Intune.

    Here are some steps you can take to troubleshoot and resolve this issue:

    1.Review the script to identify any inefficiencies or unnecessary operations that can be optimized to reduce execution time. Break down the script into smaller parts and test each part individually to identify the slowest sections.

    Here are some related issues you can refer to.

    https://www.reddit.com/r/Intune/comments/impu1m/powershell_script_successfully_runs_however/

    https://www.reddit.com/r/Intune/comments/icinc3/intune_marks_ps_script_as_failed_even_thought_it/

    Non-official, just for reference.

    2.It is well known that script execution is very slow in Intune and if you want to make it faster, you would need to create win32 app of the script.

    https://tech.tristantyson.com/DeployPowershellAsAWin32App

    Non-official, just for reference.

    Hope above information can give you some ideas.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.