We get an error “SetDevice Code: Request_BadRequest Message: Properties other than ExtendedAttribute1..15 can be modified only on windows devices”. Here is the script that we are using:
$dev = Get-AzureADDevice -All:$true | Where {$_.AccountEnabled -eq $true}
foreach ($d in $dev) {
Set-AzureADDevice -ObjectId $d.ObjectId -AccountEnabled $false
}
Even though this returns error, but it still disables the Windows devices and however does not disable mobile devices.
Also, one thing to note is, we can remove the devices using Remove-AzureADDevice using Automation.
The same scripts is running fine without error on Windows Powershell.