intune-remediation-scripts

Microsoft Intune Remediation Scripts

PowerShell Intune License: MIT GitHub stars GitHub forks GitHub issues GitHub last commit Contributions welcome Made with ❤️

Build Status

PowerShell Lint Link Check

Overview

A comprehensive collection of Microsoft Intune remediation scripts and configurations designed for enterprise endpoint management, device compliance enforcement, and automated system fixes. This repository provides production-ready PowerShell scripts that integrate seamlessly with Intune’s remediation framework.

Key Features

Quick Start

  1. Browse Examples: Start with docs/examples/intune-import/ for a complete detection/remediation pair
  2. Test Scripts: Always run with -WhatIf parameter first to preview changes safely
  3. Deploy via Intune: Follow the deployment guide for step-by-step Intune configuration

Canonical Example

Here’s a complete detection and remediation pair demonstrating proper structure:

Detection Script (detect-example.ps1)

[CmdletBinding()]
param()

try {
    $condition = Get-SomeCondition
    if ($condition) {
        Write-Information "Issue detected" -InformationAction Continue
        exit 1  # Issue found - remediation needed
    } else {
        Write-Information "No issues found" -InformationAction Continue
        exit 0  # Compliant - no remediation needed
    }
} catch {
    Write-Error "Detection failed: $_"
    exit 1
}

Remediation Script (remediate-example.ps1)

[CmdletBinding(SupportsShouldProcess=$true)]
param()

try {
    if ($PSCmdlet.ShouldProcess("System", "Apply Remediation")) {
        # Apply fix here
        Write-Information "Remediation applied successfully" -InformationAction Continue
        exit 0  # Success
    }
} catch {
    Write-Error "Remediation failed: $_"
    exit 1  # Failure
}

Usage in Intune

  1. Create new Remediation in Intune admin center
  2. Upload detection script, set to run in system context
  3. Upload remediation script, configure schedule
  4. Assign to device groups and monitor results

Directory Map

CI/Quality

Our continuous integration pipeline ensures code quality through:

All scripts follow PowerShell best practices:

Contribution/Support

Contributing

Support

Community


License

MIT License - see LICENSE file for details.

Made with ❤️ for the IT community