In this post, I’ll walk you through a real-world challenge where Intune alone wasn’t fast enough — and how I used Microsoft Graph and PowerShell to instantly trigger remediation scripts across hundreds of endpoints.
The Problem
Users still had Google accounts configured in the new Outlook, which caused:
- Profile conflicts between Microsoft 365 and Google identities.
- User confusion when switching between accounts.
- Support tickets for issues that should have been resolved silently.
The Challenge
Intune remediation scripts run based on:
- Policy sync cycles
- Intune Management Extension delays
That means you cannot trigger fixes immediately across devices using the portal alone.
The Solution
Use Microsoft Graph to trigger remediations on-demand:
- Loop through targeted devices
- Trigger the remediation per device via Graph
- Run in parallel with PowerShell 7 for massive speedups
The Script
The full script is available on GitHub:
Bulk-RunRemediation.ps1Run On-Demand Across Many Devices
Example execution:
.\Bulk-RunRemediation.ps1 `
-ScriptPackageName "Remove Google Account from New Outlook" `
-DeviceFilter "operatingSystem eq 'Windows' and ownerType eq 'company'" `
-ThrottleLimit 15 `
-MaxRetries 4
Parameters
- ScriptPackageName – Name of the Intune remediation script package.
- DeviceFilter – Microsoft Graph OData filter to scope target devices.
- ThrottleLimit – Number of parallel threads (PowerShell 7).
- MaxRetries – Retry attempts per device on transient failure.
PowerShell 5 vs PowerShell 7
- PowerShell 5: sequential execution — slow at scale.
-
PowerShell 7: parallel execution with
ForEach-Object -Parallel— massively faster.
Real-World Result
- 1500 endpoints targeted
- Executed using PowerShell 7
- Completed in under 2 minutes
Detection & Remediation
- Detection → identify devices with Google accounts configured in the new Outlook.
- Remediation → clear the offending profile cache and remove the account.
Conclusion
By combining Intune, the Microsoft Graph API, and PowerShell 7 parallel execution, we achieved near-instant remediation at scale — turning a multi-hour rollout into a 2-minute operation.