If you are on this page which means you do not wish to go through Intune GUI and select devices manually and run Sync from Bulk device Actions. Below is a PowerShell Script which will Sync all your Devices for you. Its a 4 liner. Code is for Windows Devices but you can change (operatingsystem, ‘Windows’ to iOS or Android or all of them at the same time. Just copy and paste the Code below in Windows PowerShell (I prefer to use PowerShell ISE, easy to change the code and execute). Make sure you connect to your tenant using Connect-MSGraph and login with your Intune Admin or GA account.
$Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')" | Get-MSGraphAllPages
Foreach ($Device in $Devices)
Invoke-IntuneManagedDeviceSyncDevice -managedDeviceId $Device.managedDeviceId
Write-Host "Sending Sync request to Device with DeviceID $($Device.managedDeviceId)" -ForegroundColor CYAN
You will see your output will start coming in CYAN colour with Device ID instead of Device name. You can change output colour to another colour if you wish. Cyan is easily visible and RED looks like errors to me. Output as below: