Pulling Total Physical Memory for Intune Enrolled Devices

Damon Maranya 26 Reputation points

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.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,489 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,348 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,291 questions
{count} vote