Forum Discussion
Intune remediation scripts, schedule detect scripts
I would like to run a detection script every 180 days. The detection script runs the command dism /online /cleanup-image /scanhealth. If problems are found, a remediation script should run. The remediation script also runs the command dism /online /cleanup-image /scanhealth.
The problem is that detection scripts are executed every 24 hours. This is too frequent for most of my detect scripts.
According to Microsoft:
“The Microsoft Intune Management Extension service gets the scripts from Intune and runs them. The scripts are rerun every 24 hours.”
And:
“When you configure the assignment of a script package, you can define how often the remediation runs using one of the following Schedule options.”
Source: https://learn.microsoft.com/en-us/intune/intune-service/fundamentals/remediations
When I check Monitor → Device Status, the oldest Last run timestamps are only two days old. When I check IntuneManagementExtension.log or AgentExecutor.log, I can see that the same detection scripts have been executed multiple times within the last 24 hours.
My schedule is set to Daily, with an interval of Repeats every 180 days. I originally thought this would cause the detection script to run every 180 days, but even Copilot insists that this setting only limits how often the remediation script is allowed to run.
I don't understand the logic behind this. Why not set the interval for a detect script and then run a remediation script? Why run the detect script every 24 hours and then skip the remediation script is it's run past 180 days?