A collection of detection and remediation scripts for use with Microsoft Intune's Proactive Remediations (now called Remediations in the Intune admin center).

How remediations work

Each remediation pair consists of two PowerShell scripts:

Example: clear Windows Update cache

# detect.ps1
$path = "C:\Windows\SoftwareDistribution\Download"
$items = Get-ChildItem $path -ErrorAction SilentlyContinue
if ($items.Count -gt 0) { exit 1 } else { exit 0 }
# remediate.ps1
Stop-Service -Name wuauserv -Force
Remove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
Start-Service -Name wuauserv
exit 0

Add your own scripts here — duplicate the heading and code block pattern above for each script pair.