The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest.

This guide walks through detection script vs remediation script: exit codes explained from first principles: what actually matters, what the incumbents get wrong, and how to set it up in Intune Easy Deploy Pro without a developer. Every claim about competitor pricing or limits below reflects the 2026 audit snapshot cited in our comparison hub — verify current numbers on the vendor's own pricing page before you sign anything.

Detection Script vs Remediation Script: Exit Codes Explained: at a glance
Detection Script vs Remediation Script: Exit Codes Explained: at a glance◉Step 1: The detection script's only job is to answer 'is thiDo this inside the workspace, then check the telemetry to confirm itworked.TIP~4 min hands-on⬢Step 2: The remediation script's job is to fix it and shouldDo this inside the workspace, then check the telemetry to confirm itworked.TIP~8 min hands-on⬣Step 3: Script output is capped at 2,048 characters in IntunDo this inside the workspace, then check the telemetry to confirm itworked.TIP~12 min hands-on⬔Step 4: Scripts run 32-bit PowerShell by default — registry Do this inside the workspace, then check the telemetry to confirm itworked.TIP~16 min hands-on⬒Step 5: Test both scripts against four states: healthy devicDo this inside the workspace, then check the telemetry to confirm itworked.TIP~20 min hands-on★Step 6: The detection script's only job is to answer 'is thiDo this inside the workspace, then check the telemetry to confirm itworked.TIP~24 min hands-on

The detection script's only job is to answer 'is this device broken': exit 0 means no, anything else means yes and triggers remediation.

The detection script's only job is to answer 'is this device broken': exit 0 means no, anything else means yes and triggers remediation. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest. With Intune Easy Deploy Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

How the pieces compare
How the pieces compareRelative impact, audit-weighted1008060402000%25%50%75%100%01Exit code contract0 = compliant; anything else triggers remediation88%02Output cap2,048 characters79%03Default bitness32-bit PowerShell70%04Exit code contract0 = compliant; anything else triggers remediation88%05Exit code contract0 = compliant; anything else triggers remediation88%06Exit code contract0 = compliant; anything else triggers remediation88%07Exit code contract0 = compliant; anything else triggers remediation88%08Exit code contract0 = compliant; anything else triggers remediation88%Share of workflow (%)PrimarySecondary

The remediation script's job is to fix it and should be idempotent — running it twice must be as safe as running it once.

The remediation script's job is to fix it and should be idempotent — running it twice must be as safe as running it once. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest. With Intune Easy Deploy Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

The implementation sequence
The implementation sequenceINPUTOUTCOME1The detectionscript's only jostage 1/6auto2The remediationscript's job istage 2/6auto3Script output iscapped at 2,0stage 3/6auto4Scripts run 32-bitPowerShellstage 4/6auto5Test both scriptsagainst fourstage 5/6auto6The detectionscript's only jostage 6/6WHY IT WORKSEach stage hands off structured state to the next — no rework, no lost context, full audittrail.Average end-to-end: under 6 minutes · Retry-safe at every stage

Script output is capped at 2,048 characters in Intune; log the summary to output and offload full logs elsewhere for diagnosis.

Script output is capped at 2,048 characters in Intune; log the summary to output and offload full logs elsewhere for diagnosis. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest. With Intune Easy Deploy Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

Where the impact concentrates
Where the impact concentrates12-week trajectory, illustrative10084675034170706248W1W3W5706248W1W3W582236102438W1W3W5W7W9W11peak 70Series ASeries BSeries 312-week window · illustrative

Scripts run 32-bit PowerShell by default — registry and file-system redirection can make a correct-looking script check the wrong location.

Scripts run 32-bit PowerShell by default — registry and file-system redirection can make a correct-looking script check the wrong location. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest. With Intune Easy Deploy Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

The end-to-end flow
The end-to-end flow1The detection script's only jo100%The detection script's only jon=1200 lost 0%2The remediation script's job i84%carover 84%drop 16%The remediation script's job in=1008 lost 16%3Script output is capped at 2,068%carover 81%drop 19%Script output is capped at 2,0n=816 lost 32%4Scripts run 32-bit PowerShell 52%carover 76%drop 24%Scripts run 32-bit PowerShell n=624 lost 48%5Test both scripts against four36%carover 69%drop 31%Test both scripts against fourn=432 lost 64%Biggest lever: tighten S2 to S3 handoff.Illustrative funnel from workspace telemetry, 1200 sessions.

Test both scripts against four states: healthy device, broken device, already-remediated device, and a device where remediation is impossible.

Test both scripts against four states: healthy device, broken device, already-remediated device, and a device where remediation is impossible. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The entire remediation contract fits in one rule — detection exit 0 means compliant — but the edge cases around it cause most authoring mistakes. This guide explains the contract precisely, the output limits, and the testing discipline that keeps scripts honest. With Intune Easy Deploy Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

Your launch checklist
Your launch checklistPhase 1Phase 2Phase 3Phase 4Step 1The detection script's only job is to answer 'is this devicebroken':M1Step 2The remediation script's job is to fix it and should be idempotent— rM2Step 3Script output is capped at 2,048 characters in Intune; log thesummaryM3Step 4Scripts run 32-bit PowerShell by default — registry andfile-system reM4Step 5Test both scripts against four states: healthy device, brokendevice,M5Step 1The detection script's only job is to answer 'is this devicebroken':M6Step 1The detection script's only job is to answer 'is this devicebroken':M7Step 1The detection script's only job is to answer 'is this devicebroken':M8

Frequently asked questions

What should the detection script return?

Exit code 0 when the device is compliant (nothing to fix), non-zero when the problem exists. Keep the logic to a single clear question per script.

Why 32-bit PowerShell matters?

File system and registry redirection mean HKLM\Software or System32 paths may resolve differently than in 64-bit. Either write bitness-aware code or set the execution context explicitly.

How much can the script output?

2,048 characters through Intune's native reporting. Put the verdict in the output and offload detailed logs to a storage location for troubleshooting.

Should remediation scripts be idempotent?

Yes — a remediation may run more than once against the same device. Design every action so re-running it on an already-fixed device is harmless.

Keep reading