So I have this simple script that could sync or reboot Intune devices.
It stopped working now due to the application id (d1ddf0e4-d672-4dae-b554-9d5bdfd93547) being retired.
I have many other scripts performing different Intune related tasks but all utilising MsGraph.
What exactly do I need to update to make the script working again?
Thanks!
Connect-MSGraph
$DeviceGroup = Read-Host -Prompt "Please provide the AAD group object ID"
$DeviceList = Get-Groups_Members -groupId $DeviceGroup -Select id, deviceId, displayName | get-MSGraphAllpages
$AllIntuneDevices = Get-IntuneManagedDevice -select id, operatingSystem, azureADDeviceId -Filter "contains(operatingSystem, 'iOS')" | get-MSGraphAllpages
foreach ($Device in $DeviceList)
{
$deviceIntuneId = $AllIntuneDevices | Where-Object {$_.azureADDeviceId -eq $Device.deviceId}
Write-Host $Device.deviceId
if($deviceIntuneId)
{
Invoke-DeviceManagement_ManagedDevices_SyncDevice -managementDeviceId $deviceIntuneID.id
Write-Host "Sync command has been sent to the device"
}
else {
Write-Host "$Device.deviceId not found"
}
}