Pulling Total Physical Memory for Intune Enrolled Devices
I have been asked to determine how many of our current fleet of Intune enrolled Windows 10 devices have 4GB of physical memory.
As far as I can tell the best way to get this information without going device by device in MEM is through Microsoft Graph. I can successfully pull all enrolled devices with a device query using Powershell. But the physicalMemoryInBytes attribute shows as 0 for all devices. Regardless of the value displayed on the device's Intune record, or the actual memory in the device.
I can run a targeted query in which I select the attributes I want to see (https://graph.microsoft.com/beta/deviceManagement/manageddevices('<Intune Device ID>')?$select=id,hardwareinformation,physicalMemoryInBytes), and that returns a correct value. But that means iterating through all of the devices one at a time. Which is fine, except I'm just not familiar enough with the syntax used by the Graph API to figure out how to set that query up.
Does anyone have a better way to pull the physicalMemoryInBytes attribute from Intune enrolled devices, or failing that, some insight into how I would build the foreach loop I would need to iterate through the enrolled devices? Alternately does anyone have a good resource on learning to use MS Graph? Today is literally the first time I've touched it.