{
  "id": 16968689,
  "title": "Find wasted Microsoft 365 licenses with PowerShell and Microsoft Graph",
  "url": "https://urgent.news/2026/10/28/find-wasted-microsoft-365-licenses-with-powershell-and-microsoft-graph",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-28T22:27:05.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mickythebold/find-wasted-microsoft-365-licenses-with-powershell-and-microsoft-graph-2bdo"
  },
  "original_language": "en",
  "account": "Microsoft 365 tenants often pay for licenses that remain unused due to various reasons such as employees leaving, accounts being disabled, or accounts created for temporary projects that are never utilized. To identify these wasted licenses, one must use Microsoft Graph PowerShell with read-only access. This requires PowerShell 7+, the Microsoft.Graph module, and an admin account with appropriate permissions.\n\nThe PowerShell script begins by connecting to Microsoft Graph with the necessary scopes, including User.Read.All, AuditLog.Read.All, and Organization.Read.All. The AuditLog.Read.All scope is crucial for retrieving sign-in activity data. Next, the script maps license IDs to their readable names using the Get-MgSubscribedSku cmdlet.\n\nThe script then retrieves all users, specifying the properties of interest such as IDs, display names, user principal names, account status, assigned licenses, sign-in activity, and creation date. To determine which users represent waste, the script establishes thresholds for inactivity (90 days) and a grace period for newly created accounts (30 days). Users are categorized as disabled but licensed, never signed in, or inactive for the specified duration.\n\nThe script also assigns approximate US list prices to different Microsoft 365 licenses, such as Business Premium ($22.00), Business Standard ($12.50), and Microsoft 365 E3 ($36.00). By summing the monthly costs of flagged licenses and multiplying by 12, the estimated annual waste can be calculated. For instance, in a test tenant with two disabled-but-licensed users, the waste amounts to $44.00 per month ($528.00 annually).\n\nThe complete script is freely available under the MIT license on GitHub and can be installed via the PowerShell Gallery. It exports results to a CSV file and offers customization options for thresholds and output preferences. The author encourages feedback on potential improvements and extensions for multi-tenant environments.",
  "summary": "Most Microsoft 365 tenants pay for licenses nobody uses. The usual causes: Someone leaves, their account gets disabled , but the license stays assigned. An account is created for a hire or a project and never signed into . A user stops using the account, and it sits inactive for months. Each one keeps billing every month. Here's how to find them with Microsoft Graph PowerShell, read-only. What…",
  "key_points": [
    "PowerShell script identifies wasted Microsoft 365 licenses via Microsoft Graph",
    "Waste calculated by summing monthly costs of flagged licenses and multiplying by 12"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}