Intune Remediations: when the same fix keeps coming back

12 min read
IntuneRemediationsPowerShellMSP
Intune Remediations: same fix every day, fix the cause instead

Quick answer

An Intune remediation that reports Issue fixed on the same device day after day isn't working. It's covering for something that keeps breaking the setting. Remediations also need Windows Enterprise licensing, so on Business Premium tenants they don't run at all.

  1. 1.Make the detection script count its own fixes, so the output says fixed 6 times this week instead of a plain issue found.
  2. 2.Find what breaks it. For local admin drift, Security event 4732 names the account that added the member.
  3. 3.Once you know the setting has to stay put, enforce it with a configuration policy. Without Enterprise licensing, run the same scripts from a scheduled task deployed as a platform script.

The Remediations report looks healthy. Every device shows Issue fixed, nothing shows Failed, and nobody has rung about it. Then you open the device status and see the same three laptops fixed every single day for a month.

That isn't a remediation working. It's a remediation hiding a problem. We asked MSP owners how they stop the same device issues coming back across client tenants. Parmi Lally, founder of Hot Spring IT, put it better than we could:

From the field

Recurring device issues usually mean a fix was applied in one tenant and never made it into the standard build. We keep a single, version-controlled library of detection and remediation scripts deployed identically to every client, and if a remediation keeps firing on the same devices we treat that as a sign the root cause belongs in a configuration policy, not another script.

This guide builds that idea into the scripts. The detection script counts how often it has had to fix the device, the output tells you when it keeps coming back, and the event log tells you what caused it. Then it covers the part most guides skip: running the same thing on tenants that don't have the licence for Remediations.

How Intune Remediations work

A remediation is a script package: a detection script, an optional remediation script, and a schedule. The Intune Management Extension on the device runs the detection script. If it exits with 1, it runs the remediation script, then runs detection again to confirm. Any other exit code means no issue, so the fix never runs.

SettingWhat to know
WhereIntune admin center > Devices > Manage devices > Scripts and remediations
ScheduleOnce, every n hours (under 24), or daily at a set time. Missed runs catch up when the device is online
Run asSYSTEM by default, or the signed-in user if you tick Run this script using the logged-on credentials
OutputThe last 2,048 characters of output from each script, shown per device and exportable to CSV
LimitsUp to 200 script packages. Save scripts as UTF-8. No reboots, no passwords in scripts

Results don't stream back live. The device reports when something changes, and at least once every seven days. So a device fixed every day still shows a tidy Issue fixed, and nothing in the report tells you it was the seventh time this week.

What licence do Intune Remediations need?

This is the catch for most MSP clients. Remediations need the users of the devices to have Windows Enterprise E3 or E5 (included in Microsoft 365 F3, E3 and E5), Windows Education A3 or A5, or Windows VDA. Microsoft 365 Business Premium is not on that list. It includes Intune, but Windows Business rather than Windows Enterprise, so the Remediations page stays greyed out.

The usual workaround is a scheduled task on each device, and that's the approach later in this guide. The same detection and remediation scripts work either way. Only the thing that runs them changes.

Why does an Intune remediation keep firing on the same device?

Because something keeps undoing the fix. In practice, it's usually one of these:

  • A tool or agent with its own idea of the setting. An RMM policy, an OEM utility or an app installer that runs as SYSTEM and puts the setting back.
  • A person. A tech who adds a user to local Administrators "just for today" on every visit.
  • Another policy. A GPO, a second Intune profile, or a baseline in a different tenant that sets it the other way.
  • The build. Parmi's point: the fix went into one tenant and never into the image or the baseline, so every new device starts broken.

A remediation can't tell these apart. It sees the setting wrong, puts it right, and reports success. You only find the cause if the scripts record enough to point at it.

The example: local admin drift

We used a problem every MSP has: accounts turning up in the local Administrators group that shouldn't be there. To reproduce it, our lab VM (Windows 11 Pro, 26H2) runs a scheduled task as SYSTEM that adds a helpdesk-temp account every two hours, which is what a badly behaved agent or a tech's script looks like from the device's side. The fix runs every hour. We left both running over a weekend.

Two warnings before you copy this to a real tenant. First, get the allow list right: anything that isn't on it gets removed, including the account you're signed in with. Second, if you manage local admins through Windows LAPS, keep its account on the list. Our Windows LAPS rotation guide covers that side.

The detection script

The CONFIG block at the top:

PowerShell
Preview snippet. The full, tested script lives in the vault.
# ===== CONFIG =====
$AllowedMembers = @('it-admin', 'labadmin')   # accounts that may stay in local Administrators
$LogPath        = Join-Path $env:ProgramData 'Atliso\LocalAdminDrift.log'
$RecurDays      = 7                           # look back this far when counting repeat fixes
# ==================
Excerpt. The full script is tested and MIT licensed.Get the full script

It reads the group through ADSI rather than Get-LocalGroupMember, which can throw when the group holds a SID it can't resolve. It leaves the built-in Administrator and the Entra roles that Windows adds at join alone, and treats everyone else not on the allow list as drift:

PowerShell
Preview snippet. The full, tested script lives in the vault.
$unexpected = @(Get-AdminMembers | Where-Object {
    $_.Sid -notmatch '^S-1-5-21-.+-500$' -and      # built-in Administrator
    $_.Sid -notmatch '^S-1-12-1-' -and             # Entra roles and groups added at join
    $AllowedMembers -notcontains $_.Short
})
if ($unexpected.Count -eq 0) { Write-Output "Clean. Fixed $fixes time(s) in the last $RecurDays days."; exit 0 }
# ...build the message...
exit 1   # Intune runs the remediation script only on exit 1

Count the repeat fixes

This is the part that turns Parmi's rule into something you can see. Every fix writes a line to a log on the device. Detection counts the lines from the last seven days and puts the number in its output, which is what Intune shows per device and what lands in your CSV export:

PowerShell
Preview snippet. The full, tested script lives in the vault.
# Every fix writes a FIXED line. Count the ones in the last $RecurDays days.
$since = (Get-Date).AddDays(-$RecurDays)
$fixes = @(Get-Content $LogPath | Where-Object {
    $_ -match '^(\S+ \S+) FIXED' -and [datetime]$Matches[1] -ge $since
}).Count
if ($fixes -ge 3) { $msg += ' Keeps coming back: find the cause or move this to a policy.' }

Find out what added the account

Windows logs Security event 4732 when a member is added to a security-enabled local group. The Security Group Management audit subcategory that logs it was already on in our lab, which is the Windows default. Detection reads the newest 4732 for Administrators and names who did it. When that's SYSTEM, it's a service, a scheduled task or an installer, not a person:

PowerShell
Preview snippet. The full, tested script lives in the vault.
# Event 4732: a member was added to a security-enabled local group
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4732 } -MaxEvents 50 |
    Where-Object { $_.Properties[4].Value.Value -eq 'S-1-5-32-544' } |   # the Administrators group
    Select-Object -First 1 TimeCreated,
        @{ n = 'AddedBy'; e = { $_.Properties[6].Value } },
        @{ n = 'BySid';   e = { $_.Properties[5].Value.Value } }        # S-1-5-18 = SYSTEM

Run by hand on the lab VM, while the drift was in place:

PowerShell running Detect-LocalAdminDrift.ps1: unexpected admin helpdesk-temp, last added by SYSTEM, fixed 3 times in the last 7 days, keeps coming back, exit code 1
Detection on the lab VM: an unexpected admin, added by SYSTEM, fixed three times already (counting our test runs), so the output says it keeps coming back. Exit code 1 means the fix runs.

The remediation script

It applies the same allow rules, removes everyone else, and records what it did twice: a FIXED line in the log that detection counts, and event 1001 in the Application log under the source Atliso, so it shows up in whatever reads your event logs. It ships with $WhatIf = $true, so at first it only logs a WHATIF line for each account it would remove. Set it to $false once that list holds only accounts you want gone.

PowerShell
Preview snippet. The full, tested script lives in the vault.
$group = [ADSI]"WinNT://./Administrators,group"
# ...same allow rules as detection...
if (-not $WhatIf) { $group.Remove($path) }
Add-Content -Path $LogPath -Value "$stamp FIXED removed $name"
Write-EventLog -LogName Application -Source 'Atliso' -EventId 1001 -EntryType Warning -Message "Removed from local Administrators: $name"
Security event 4732 entries showing the machine account and a user adding members to Administrators, and Application event 1001 entries from the Atliso source showing helpdesk-temp removed three times
Both sides in the event log. 4732 shows who added the account: WG-LAB-W11-01$ is the machine account, which is what SYSTEM looks like here. 1001 is our fix taking it out again.

Deploy it as an Intune Remediation

If your clients have Windows Enterprise licensing:

  1. Intune admin center > Devices > Manage devices > Scripts and remediations > Create.
  2. Upload Detect-LocalAdminDrift.ps1 as the detection script and Remediate-LocalAdminDrift.ps1 as the remediation script. Upload the files rather than pasting, so the encoding stays UTF-8.
  3. Leave Run this script using the logged-on credentials off. It needs SYSTEM to change group membership.
  4. Assign it to a device group with an hourly or daily schedule.
  5. After a day, open the package, then Device status, and add the Pre-remediation detection output column. Any device saying keeps coming back needs a look at the cause, not another fix.

We couldn't screenshot this part. Our lab tenant has no Windows Enterprise licence, which is the same position most small MSP clients are in. So the rest of the lab ran the way you'd run it on Business Premium.

Remediations without Windows Enterprise: a scheduled task

Intune platform scripts need only Intune Plan 1, but they run once per device and run again only if they fail or you change them. That's no good for a check that should run every hour. So the platform script doesn't do the check. It installs a scheduled task that does.

The runner does what the Intune Management Extension does for a remediation: detect, fix if needed, detect again to confirm, and log each step.

PowerShell
Preview snippet. The full, tested script lives in the vault.
# Invoke-AtlisoRemediation.ps1: what Remediations does, for devices without the licence
$pre = & $ps -NoProfile -ExecutionPolicy Bypass -File "$Folder\Detect-LocalAdminDrift.ps1"
if ($LASTEXITCODE -eq 0) { Add-Content $log "$stamp CHECK $pre"; exit 0 }

Add-Content $log "$stamp DETECT $pre"
& $ps -NoProfile -ExecutionPolicy Bypass -File "$Folder\Remediate-LocalAdminDrift.ps1" | Out-Null
$post  = & $ps -NoProfile -ExecutionPolicy Bypass -File "$Folder\Detect-LocalAdminDrift.ps1"
$state = if ($LASTEXITCODE -eq 0) { 'CONFIRMED' } else { 'STILL-FAILING' }

The installer is the platform script. It writes the three scripts to ProgramData, locks the folder down so only SYSTEM and Administrators can change them, and registers an hourly task that runs as SYSTEM. Locking the folder matters: a script that SYSTEM runs every hour from a folder users can write to is a free route to SYSTEM.

PowerShell
Preview snippet. The full, tested script lives in the vault.
$Folder = Join-Path $env:ProgramData 'Atliso\Remediations\LocalAdminDrift'
New-Item -ItemType Directory -Path $Folder -Force | Out-Null
icacls $Folder /inheritance:r /grant:r '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F'   # SYSTEM and Administrators only
foreach ($name in $files.Keys) {   # the three scripts travel inside the installer, with your allow list written in
    [IO.File]::WriteAllText((Join-Path $Folder $name), $files[$name], (New-Object Text.UTF8Encoding $true))
}

$action  = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument ('-NoProfile -ExecutionPolicy Bypass -File "' + $Folder + '\Invoke-AtlisoRemediation.ps1"')
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(2) -RepetitionInterval (New-TimeSpan -Hours 1)
Register-ScheduledTask -TaskName 'Atliso - Local admin drift' -TaskPath '\Atliso\' -Action $action -Trigger $trigger -Principal (New-ScheduledTaskPrincipal -UserId 'SYSTEM' -RunLevel Highest) -Force

The installer in the download carries all three scripts inside it, so it's the only file you upload. Set the allow list in its CONFIG block, then:

  1. Intune admin center > Devices > Manage devices > Scripts and remediations > Platform scripts > Add > Windows 10 and later.
  2. Upload the installer. Run as SYSTEM, signature check off, 64-bit on.
  3. Assign it to a device group. Change the installer whenever you change the scripts, so Intune runs it again.
Get-ScheduledTaskInfo for the Atliso - Local admin drift task: last result 0, next run in an hour, running Invoke-AtlisoRemediation.ps1 as SYSTEM every hour (PT1H)
The task on the lab VM: runs the runner script as SYSTEM, every hour (PT1H), last result 0.

What you give up: the central report. The results live in a log on each device, and nobody sees them unless something reads them. Event 1001 helps if you already collect event logs. Otherwise you're back to finding out from the user, which our guide to non-compliant devices covers from the other side.

Check it worked

On the device, the log shows every run. A device that keeps needing the fix has a trail of DETECT, FIXED and CONFIRMED lines:

PowerShell
Preview snippet. The full, tested script lives in the vault.
Get-Content C:\ProgramData\Atliso\LocalAdminDrift.log -Tail 6

2026-11-15 15:24:20 DETECT Unexpected admin(s): WG-LAB-W11-01\helpdesk-temp. Last added by SYSTEM ... Fixed 0 time(s) in the last 7 days.
2026-11-15 15:24:20 FIXED removed WG-LAB-W11-01\helpdesk-temp
2026-11-15 15:24:21 CONFIRMED Clean. Fixed 1 time(s) in the last 7 days.
LocalAdminDrift.log on the lab VM showing helpdesk-temp detected and removed every two hours, the fix count climbing to 16, and the Keeps coming back warning
A day of the lab log. Something re-adds the account every two hours, the remediation removes it each time, and the count passes 3 so detection says to find the cause. Every check reports clean in between.

If the line after a FIXED says STILL-FAILING, the fix didn't hold even for a second, which usually means a policy is fighting it in real time. Look for a second profile or a GPO that sets the group.

When a script isn't the answer

Once the count says it keeps coming back, you have two jobs. Find the cause, using event 4732 and the time it happens, and stop it. Then enforce the end state with a policy instead of correcting it every hour.

For local admins that's an Endpoint security > Account protection policy with the Local user group membership profile, which manages the group through the LocalUsersAndGroups CSP. Its Replace action sets the whole membership list, so test it on one device before a client's whole estate. Microsoft and most community guides also advise applying only one of these policies to each device, because two conflict. Unlike Remediations, Microsoft lists no Enterprise licence for it, only Windows 10 20H2 or later, or Windows 11.

That's Parmi's point again: fix it in the standard build once, and you don't need a script to fix it on every device. Remediations are for the gap between the two, and the repeat count tells you when a gap has turned into a habit.

Questions admins ask

What licence do Intune Remediations need?

The users of the devices need Windows Enterprise E3 or E5 (included in Microsoft 365 F3, E3 and E5), Windows Education A3 or A5, or Windows VDA per user. Microsoft 365 Business Premium is not on the list, because it includes Windows Business, not Windows Enterprise.

Can I use Remediations with Business Premium?

Not as licensed today. The usual workaround is a platform script, which only needs Intune Plan 1, that installs a scheduled task to run the same detection and remediation scripts on the device. You lose the central report, so you need another way to see the results.

How often do Intune Remediations run?

On the schedule in the assignment: once, every few hours (under 24), or daily at a set time. A device that misses a run catches up when it next comes online. Results report back when something changes, and at least every seven days.

Why does my remediation script never run?

The remediation script only runs when the detection script exits with code 1. Any other exit code, including an error or no output, counts as no issue found. Check your detection script ends with exit 1 on the failure path and that nothing throws before it gets there.

How do I know a remediation keeps fixing the same thing?

In Intune, the device status shows Issue fixed again and again, and you can export the detection output to CSV. Counting fixes per device is easier if the detection script does it itself, as in this guide, so the output says how many times it was fixed this week.

What is the difference between a platform script and a remediation?

A platform script runs once per device, and runs again only if it fails or you change it. A remediation runs a detection script on a schedule and only runs the fix when something is wrong, then reports both results.

Run this across every client without the clicking

Atliso checks every device in your client tenants every night, deploys its fixes as Remediations where the tenant is licensed and as platform scripts where it isn't, and raises what it finds as a ticket in your helpdesk. That covers BitLocker keys missing from Entra, LAPS passwords that stopped rotating and devices that stopped checking in. There's a 30-day free trial, and you can see the sample report first.

Sources

Get the Local Admin Drift script

Free and MIT licensed. Drop your email and the vault unlocks straight away with the full, tested script, plus new tools when they ship. No spam.

Current version v1.0.0, updated 30 Nov 2026 · Version history