Intune - Detection and Remediation Script Schedule

Ahmed Alshatawi 205 Reputation points
2025-02-14T16:42:38.9166667+00:00

Hello!
I have a question about detection and remediation in Intune—how they work and when they run. I created a detection and remediation script in Intune and scheduled it to run every day at 4 PM.

  • Detection: The script will detect if a device hasn’t been rebooted for 14 days or more.
  • Remediation: The script will force a reboot if no user is logged in. If a user is logged in, it will notify the user 10 minutes before forcing a reboot.

Question: Will the detection script run daily at 4 PM, and will remediation execute if the device hasn’t been rebooted for 14 days? What happens if the device is in sleep mode, powered off, or the lid is closed? Will the detection and remediation scripts still run in these cases?

I’m also wondering whether the detection and remediation scripts will execute only when the device is powered on, or if they will still run while the device is in sleep mode or the lid is closed.
Additionally, should I keep the setting below as “No”?
User's image

Windows Autopilot
Windows Autopilot
A collection of Microsoft technologies used to set up and pre-configure new devices and to reset, repurpose, and recover devices.
502 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
5,569 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZhoumingDuan-MSFT 16,280 Reputation points Microsoft Vendor
    2025-02-17T01:38:17.6033333+00:00

    @Ahmed Alshatawi, Thanks for posting in Q&A.

    Q1. Will the detection script run daily at 4 PM?

    A1. If you’ve scheduled your detection script to run daily at 4 PM, it will only execute at that time if the device is on

    Q2. will remediation execute if the device hasn’t been rebooted for 14 days?

    A2. Yes, it will.

    Q3. What happens if the device is in sleep mode, powered off, or the lid is closed?

    A3. The script will not run in sleep mode, powered off, or with the lid closed unless configured to wake up.

    Q4.Will the detection and remediation scripts still run in these cases?

    A4. Remediation will only trigger if the device is actively checking in with Intune. If it’s asleep or off, the script won’t run until it’s awake. And if the device is in sleep mode or powered off at 4 PM, the tasks will simply be delayed until the device wakes up.

    https://learn.microsoft.com/en-us/mem/intune/fundamentals/remediations#client-policy-retrieval-and-client-reporting

    https://learn.microsoft.com/en-us/mem/intune/fundamentals/remediations#run-a-remediation-script-on-demand-preview

    For the script settings, if the script is required to run in the system context, choose Run this script using the logged on credentials No. If the device is 64-bit, please choose Run script in 64-bit PowerShell host Yes.

    User's image

    Hope above information can help you.

    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 additional answers

Sort by: Most helpful

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.