PowerShellMicrosoft GraphPHP Teams

Intune Device Memory Management

PowerShell and SaaS integration for analyzing and displaying Intune device memory requirements.

📖 Read Full Engineering Guide →
### FILE: index.php
<?php 
session_start();
$accessToken = $_SESSION['ms_access_token'];
$devices = $ms->graphCall('/deviceManagement/managedDevices', $accessToken, 'GET');
foreach ($devices['value'] as $device) {
    if ($device['operatingSystem'] === 'Windows' && $device['memoryGB'] < 8) {
        render_premium_card('Memory Upgrade Required', 'Device ID: ' . $device['id'], null, 'up', '⚠️', null);
    }
}
?>

### FILE: scripts/CheckDeviceMemory.ps1
<#
.SYNOPSIS
   Checks Intune-managed devices for necessary memory upgrades.
.DESCRIPTION
   This script connects to Microsoft Graph to analyze devices managed under Intune, identifying those that require memory upgrades.
.EXAMPLE
   .\CheckDeviceMemory.ps1
.NOTES
   Author:      Souhaiel Morhag
   Company:     MSEndpoint.com
   Blog:        https://msendpoint.com
   Academy:     https://app.msendpoint.com/academy
   LinkedIn:    https://linkedin.com/in/souhaiel-morhag
   GitHub:      https://github.com/Msendpoint
   License:     MIT
#>

try {
    Connect-MgGraph -Scopes "DeviceManagementApps.ReadWrite.All"
    $devices = Get-MgDeviceManagementManagedDevice | Where-Object { $_.OperatingSystem -eq "Windows" }
    $devices | ForEach-Object {
        if ($_.memoryGB -lt 8) {
            Write-Output "Device $($_.Id) requires a memory upgrade."
        }
    }
} catch {
    Write-Error "An error occurred: $_"
}

⚠️ Always review and validate PowerShell scripts in a non-production pilot group before tenant-wide deployment.

🎓 Preparing for MD-102, SC-300, AZ-104 or AB-650?

Practice 1,060+ Microsoft Learn-verified exam questions in Pearson VUE simulator mode.

Free MD-102 Exam → vs MeasureUp