In the past, I would get all Intune devices with “Invoke-RestMethod” and do select-object on returned data. Now that I have to use “Invoke-MgGraphRequest”, the returned array does not like select-object. The property value gets returned by “Array.property” name but not by select-object
is there a way to use select-object here?
In the example below :
$Devices | select deviceName #Does not work#
$Devices.devicename #it works#
$uri = "https://graph.microsoft.com/beta/deviceManagement/managedDevices?`$Filter= (deviceType eq 'desktop') or (deviceType eq 'windowsRT') or (deviceType eq 'winEmbedded')" #30 min to run - 136 trys
$DevicesResponse = (Invoke-MgGraphRequest -Uri $uri -Method Get)
$Devices = $DevicesResponse.value
$DevicesNextLink = $DevicesResponse."@odata.nextLink"
$i = 0
while ($DevicesNextLink -ne $null)
{
write-host $i -BackgroundColor DarkGreen
$DevicesResponse = (Invoke-MgGraphRequest -Uri $DevicesNextLink -Method Get)
$DevicesNextLink = $DevicesResponse."@odata.nextLink"
$Devices += $DevicesResponse.value
$i++
$Devices.count
$date = get-date
$date.DateTime
}