This is how you would force an Intune sync for ALL devices.
# MrNetTek # eddiejackson.net # 7/10/2024 # free for public use # free to claim as your own Install-Module -Name Microsoft.Graph.Intune -Force -AllowClobber Install-Module -Name Microsoft.Graph.DeviceManagement.Actions -Force -AllowClobber Install-Module -Name Microsoft.Graph.DeviceManagement -Force -AllowClobber # Connect to Graph Connect-MgGraph -scope DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementManagedDevices.ReadWrite.All,DeviceManagementManagedDevices.Read.All # Retrieve devices. This is where filters would go as well. $Devices = Get-MgDeviceManagementManagedDevice -Filter "contains(operatingsystem,'Windows')" -All clear-host Write-host "Welcome to Intune Sync!`n`n" -ForegroundColor Green Foreach ($Device in $Devices){ Sync-MgDeviceManagementManagedDevice -ManagedDeviceId $Device.Id Write-Host "$($Device.DeviceName) syncing..." -ForegroundColor Yellow Write-host "$($Device.DeviceName) $($Device.Id)" -ForegroundColor White Write-Host "`n" } # Session Clean up $Devices = "" $Device = "" Disconnect-MgGraph