PowerShell script to force Microsoft Intune sync on all managed devices or filtered by OS type via Microsoft Graph API.
In enterprise environments, devices sometimes go out of sync with Intune policies. This script forces an immediate sync across all managed devices without waiting for the default sync interval.
- Sync all devices or filter by OS (Windows, iOS, Android, macOS)
- Real-time progress bar during sync
- Exports detailed sync log to CSV with timestamps
- Error handling for failed devices
- Auto-installs required Microsoft Graph modules
- PowerShell 5.1 or later
- Microsoft Graph PowerShell module (auto-installed)
- Intune Administrator or Global Administrator role
# Sync all devices
.\Invoke-IntuneDeviceSync.ps1
# Sync Windows devices only
.\Invoke-IntuneDeviceSync.ps1 -DeviceOS Windows
# Sync iOS devices with custom log path
.\Invoke-IntuneDeviceSync.ps1 -DeviceOS iOS -LogPath "C:\Reports\sync.csv"- CSV log file with device name, sync status, timestamp, and errors
- Console summary showing total synced, successful, and failed
Hamza Ali — IT Cybersecurity Engineer | Dubai, UAE