Get-IntuneManagedDevice don't always retrieve activationLockBypassCode
p0shkar opened this issue · 1 comments
Seems like when running Get-IntuneManagedDevice towards multiple devices the output for activationLockBypassCode is always $null.
$Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'iOS')" -select serialNumber, userDisplayName, activationLockBypassCode, managedDeviceOwnerType | Get-MSGraphAllPages
$Devices | select -first 3
serialNumber userDisplayName activationLockBypassCode managedDeviceOwnerType
------------ --------------- ------------------------ ----------------------
############ Name SurName company
############ Some User company
############ Other User company
However, when specifying a deviceID this works great.
Get-IntuneManagedDevice -managedDeviceId $devices[1].ID -select activationLockBypassCode
@odata.context activationLockBypassCode
-------------- ------------------------
https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices(activationLockBypassCode)/$entity XXXXX-XXXXX-XXXX-XXXX-XXXX-XXXX
Not sure if this is as intended, but it seems like a bug to me. My guess is that GraphAPI by default don't retrieve activationLockBypassCode, but even when using -select it will return a $null value.
It can be worked around by first fetching all devices and then loop them through, but this add a lot of time for what should be a simple query.
I'm sure that this can be done by purely using GraphAPI, but I'm still a graph rookie and am much more comfortable using PowerShell.
Command: Get-IntuneManagedDevice
Module: Microsoft.Graph.Intune
Version: 6.1907.1.0
Same problem here ... in June 2024.
Wasted hours to figure out, that I can only retreive the activationLockBypassCode by passing the deviceID and not by filter.
What's going on here!?