- Modern App Packaging: Standardize on Win32 apps (
.intunewin) or the Intune Enterprise Application Management catalog for granular detection rules, supersedence, and dependencies—never rely on legacy MSI LOB mixing during Autopilot. - Defender for Endpoint Integration: Connect Intune directly to Microsoft Defender for Endpoint so real-time EDR device risk scores dynamically gate Conditional Access access to Microsoft 365.
- Self-Healing Endpoints: Replace one-off startup scripts with Intune Remediations (Detection + Remediation PowerShell pairs) that automatically fix registry drift, stale services, and local admin violations on schedule.
In Chapter 7, we configured Windows Autopilot, automatic MDM enrollment, and compliance policies. Now we harden and operationalize those endpoints at scale using Win32 App Deployment, Microsoft Defender for Endpoint (MDE) integration, and Intune Remediations.
1. Intune Endpoint Security & App Delivery Architecture
2. Packaging & Deploying Win32 Apps (.intunewin) Cleanly
Every Win32 app deployed via the Intune Management Extension (IME) requires the Microsoft Win32 Content Prep Tool (IntuneWinAppUtil.exe):
# Package a silent installer (e.g., 7-Zip or custom agent MSI/EXE) into .intunewin
.\IntuneWinAppUtil.exe `
-c "C:\IntunePackages\Source\7Zip" `
-s "7z2408-x64.msi" `
-o "C:\IntunePackages\Output" `
-q
Production Win32 Deployment Rules:
- Install behavior: Always select System for machine-wide tools and 64-bit context in Detection Rules so registry checks don't silently redirect to
WOW6432Node. - Return codes: Keep standard
0(Success),1707(Success),3010(Soft Reboot), and1641(Hard Reboot). - Supersedence: Use Intune App Supersedence to upgrade older Win32 versions cleanly instead of pushing overlapping uninstall scripts.
3. Integrating Microsoft Defender for Endpoint (MDE) with Intune
In Microsoft Intune Admin Center → Endpoint security → Microsoft Defender for Endpoint:
- Toggle Connect Microsoft Defender for Endpoint to Microsoft Intune to On (and enable Allow Microsoft Defender for Endpoint to enforce Endpoint Security Configurations for Security Settings Management).
- Create an Endpoint Detection and Response (EDR) Onboarding Policy targeting all corporate Windows 10/11 devices.
- Enable Attack Surface Reduction (ASR) rules (start in Audit mode for 14 days, then switch to Block—especially Block credential stealing from LSASS and Block Office applications from creating executable content).
- Update your Device Compliance Policy (Chapter 7) to require Microsoft Defender for Endpoint Machine Risk Score ≤ Low.
4. Building Self-Healing Intune Remediations (Detection + Remediation)
Intune Remediations (Devices → Scripts and remediations) run a lightweight PowerShell Detection script on a schedule. If it exits 0, nothing happens; if it exits 1, Intune automatically triggers the Remediation script.
Example: Detect & Remediate Unauthorized Local Administrators
Detection Script (Detect-RogueLocalAdmins.ps1):
$allowedAdmins = @("Administrator", "BuiltInAdmin", "LAPSAdmin")
$members = Get-LocalGroupMember -Group "Administrators" -ErrorAction SilentlyContinue |
Where-Object { $_.ObjectClass -eq "User" -and $_.PrincipalSource -eq "Local" }
$rogue = $members | Where-Object {
$shortName = ($_.Name -split "\\")[-1]
$shortName -notin $allowedAdmins
}
if ($rogue) {
Write-Output "Rogue local admin(s) detected: $($rogue.Name -join ', ')"
exit 1
} else {
Write-Output "Local Administrators group is compliant."
exit 0
}
Remediation Script (Remediate-RogueLocalAdmins.ps1):
$allowedAdmins = @("Administrator", "BuiltInAdmin", "LAPSAdmin")
$members = Get-LocalGroupMember -Group "Administrators" -ErrorAction SilentlyContinue |
Where-Object { $_.ObjectClass -eq "User" -and $_.PrincipalSource -eq "Local" }
foreach ($m in $members) {
$shortName = ($m.Name -split "\\")[-1]
if ($shortName -notin $allowedAdmins) {
Remove-LocalGroupMember -Group "Administrators" -Member $m.Name -ErrorAction Stop
Write-Output "Removed unauthorized local admin: $($m.Name)"
}
}
Chapter 8 Verification Checklist
- [ ] All custom enterprise apps are packaged as Win32 (
.intunewin) or deployed via Enterprise Application Management. - [ ] Microsoft Defender for Endpoint is connected to Intune, and compliance policies enforce Risk Score ≤ Low.
- [ ] Attack Surface Reduction (ASR) rules and Tamper Protection are deployed via Endpoint Security profiles.
- [ ] At least one Intune Remediation script package is actively monitoring configuration drift across your fleet.
💬 Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update