All articles

Scheduled Intune Remediations

When working with Intune, I ran into a challenge: I needed a way to schedule the execution of a remediation script so it wouldn’t run before a specific date or time. Intune offers great deployment capabilities, but it doesn’t natively support scheduling scripts with time-based conditions. That limitation sparked an idea. Why not build the scheduling logic directly into the script? By adding timestamp checks, I could control when the script executes, even after deployment through Intune.

The detection script depends entirely on your needs. There is no need to add a timestamp check in your detection. Note: Reporting might lack correct statusses. since this is not an intended use-case.

Remediation on exact date

This example script executes only on a specific date defined within the script itself. This approach allows you to maintain Intune’s existing schedule options: Once, Hourly, and Daily. The script includes this extra layer of control. By embedding a timestamp check, the script ensures it won’t run before or after the designated date, giving you flexibility that Intune doesn’t natively provide.

# Execution timestamp
$RunTimestamp = "23-11-2025"

# Parse scheduled timestamp and compare
$RunDateTime = [datetime]::ParseExact($RunTimestamp,'dd-MM-yyyy',$null)
if ((Get-Date).Date -ne $RunDateTime.Date) {
    Write-Host "Remediation not executed. Only runs on $RunTimestamp."
    return
}

Example script: ScheduledRemediationScripts/Remediate_DelayedExecution_ExactDate.ps1 at main · j0eyv/ScheduledRemediationScripts

Remediation before specific date

This script adds an extra layer of control to Intune deployments by using a timestamp check. It will continue executing until the designated date and time is reached, after which it stops. You can still leverage Intune’s built-in scheduling options: Once, Hourly, and Daily. The script only runs within the intended timeframe.

# Execution timestamp
$RunTimestamp = "25-11-2025 12:00"

# Parse scheduled timestamp and compare
$RunDateTime = [datetime]::ParseExact($RunTimestamp,'dd-MM-yyyy HH:mm',$null)
if ((Get-Date) -lt $RunDateTime) {
    Write-Host "Remediation not executed. Before scheduled time $RunTimestamp."
    return
}

Example script: ScheduledRemediationScripts/Remediate_DelayedExecution_BeforeTimestamp.ps1 at main · j0eyv/ScheduledRemediationScripts

Remediation after specific date

This script adds an extra layer of control to Intune deployments by using a timestamp check. It will only executing after the designated date and time is passed. Before this date, it won’t execute. You can still leverage Intune’s built-in scheduling options: Once, Hourly, and Daily.

# Execution timestamp
$RunTimestamp = "25-11-2025 12:00"

# Parse scheduled timestamp and compare
$RunDateTime = [datetime]::ParseExact($RunTimestamp,'dd-MM-yyyy HH:mm',$null)
if ((Get-Date) -lt $RunDateTime) {
    Write-Host "Remediation not executed. Currently before scheduled time $RunTimestamp."
    return
}

Example script: ScheduledRemediationScripts/Remediate_DelayedExecution_AfterTimestamp.ps1 at main · j0eyv/ScheduledRemediationScripts

Written by Joey Verlinden

Back to all articles

Search articles

Loading articles...