When deploying policy settings or applications via Intune the devices need to sync (as per their sync cycles) and that might take some time. We know that we can invoke a sync from Intune console using Bulk Device Actions however, there is a limitation that the sync can be initiated to max 100 device at a time.
So how do we force the sync on all devices just like we did the gpupdate /force in our on-prem environment? We use MS-Graph and PowerShell to do the trick.
Open a PowerShell console as admin and execute the below commands to install the pre-requisites. Set the Execution Policy as Unrestricted.
Install-Module -Name Microsoft.Graph.Intune
Import-Module -Name Microsoft.Graph.Intune
Connect-MSGraph
Here is the script to force the sync for all Windows devices.
$Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')"
$Devices.count
Foreach ($Device in $Devices)
{
Invoke-IntuneManagedDeviceSyncDevice -managedDeviceId $Device.managedDeviceId
Write-Host "Sending Sync request to Device with DeviceID $($Device.managedDeviceId)"
}
The results!
You can change the -filter for OS to 'IOS' or 'Android' to force sync mobile devices.
That's all for today.
Comments