2021 Jun 13

A Fast Way to Sync All Devices in Intune

This example is used for the cases when you have made some changes to Intune, and want to send the "Sync" signal to all machines in mind. The example is using Windows, as it is the most common OS. You can select any OS you want, just replace Windows with macOS, Android or iOS. Also, you can remove filter at all - that will sync all the devices regardless of the OS.

If you are deploying a new software package, or making some changes to the configuration, you might need to force the communication, as waiting could be thrilling or boring. So in that case you can use the following short script:

Connect-MSGraph
$Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')"
Foreach ($Device in $Devices) {
Invoke-IntuneManagedDeviceSyncDevice -managedDeviceId $Device.managedDeviceId
Write-Host "Sending Sync request to device $($Device.deviceName)"
}

The first line is used to actually connect to your tenant with a privileged account, you might need to verify the identity with password and/or MFA. After that we just have a short loop to run one particular command on each device from the list obtained on line 2. It's better to send by the deviceID, but it won't bother the Endpoint Manager to show the real device name instead of that ID, so it would be more comprehensive for sure.