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

X-Box-11-2021 325 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,038 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ZhoumingDuan-MSFT 16,830 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.


  2. X-Box-11-2021 325 Reputation points
    2025-03-15T20:01:40.17+00:00

    Eventually ended up with removing PS script and creating device configuration profile.

    Unfortunately, this doesn't work either.

    These are the steps I followed.

    1. Browse to the Microsoft Endpoint Manager and sign in.
    2. Click Devices, then click Configuration Profiles.
    3. Click Create profile. The Create a profile window is displayed.
    4. Select the most appropriate Windows platform.
    5. For profile type, select Settings Catalog.
    6. In Name the profile, enter a meaningful name; for example: Disable Signatures.
    7. Click Next.
    8. Click Add settings.
    9. Scroll down to, and expand, Microsoft Outlook 2016 (this setting works for Outlook 2016 and above).
    10. Select Outlook Options.
    11. Select Mail Format.
    12. In the Settings picker, tick the option Do not allow signatures for e-mail messages (User). Example:
    13. Enable the option Do not allow signatures for e-mail messages (User). Example: 
    14. Click Next.
    15. (Optional) Add Scope tags as required.
    16. Click Next.
    17. Click Add groups and specify a group in Azure or click Add all users to include the required users in this profile.
    18. Click Next.
    19. Review the settings, then click Create

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.