/
/

How to Prevent Microsoft 365 License Waste with Usage Analytics and Automation

How to Prevent Microsoft 365 License Waste with Usage Analytics and Automation blog banner image

License waste is a prevalent issue in Microsoft 365 environments. SMBs and MSP-managed clients with dynamic user bases lose billions of dollars yearly on unused and underutilized licenses.

The good news is it’s highly preventable. Microsoft 365 has built-in tools and APIs that organizations can use to analyze and optimize their license usage. However, the key to real savings lies in optimization.

This guide discusses how to prevent Microsoft 365 license waste through usage analytics and automation. Keep reading to learn more about the common causes of license waste.

Preventing Microsoft 365 license waste with usage analytics and automation

📌 Prerequisites:

  • Access to Microsoft 365 Admin Center or Microsoft Entra ID: You need access to either the Microsoft 365 Admin Center or the Microsoft Entra ID portal to manage licenses and view reports.
  • Global or License Administrator Role: You must be a Global Administrator or License Administrator. Otherwise, you won’t be able to configure or view sign-in data.
  • PowerShell Module: You need to install and configure the Microsoft Graph SDK and MSOnline PowerShell Module.
  • Azure AD Sign-in Logs and Usage Reports: You must ensure that the sign-in logs and usage reporting are enabled in Microsoft Entra ID.
  • Intune or Microsoft Endpoint Manager Integration: It’s recommended that you integrate Microsoft Intune or Microsoft Endpoint Manager to track device-level activity.

📌 Recommended deployment strategies:

Click to Choose a Method 💻

Best for Individual Users

💻💻💻

Best for Enterprises

Method 1: Identify Inactive Users via Microsoft 365 Usage Reports
Method 2: Audit License Usage with PowerShell
Method 3: Use Group-Based Licensing and Dynamic Groups
Method 4: User Registry to Disable Local Office Apps for Unlicensed Users
Method 5: Use Group Policy to Support Usage Enforcement
Method 6: Use CMD for Local User License Checks

Method 1: Identify Inactive Users via Microsoft 365 Usage Reports

📌 Use Case: You want to optimize your organization’s license usage by identifying users who haven’t used any Microsoft 365 services in the last 90 days.

  1. Sign in to the Microsoft 365 Admin Center
  2. Go to Reports > Usage > Active users – Microsoft 365 Services.
  3. Set time to Last 30/90 days.
  4. Filter by activity (e.g., Exchange, OneDrive, SharePoint, Teams, Yammer).
  5. Export the data to CSV for offline analysis.
  6. Identify which users have no recorded activity across the services as mentioned above.

💡 Tip: You can schedule and integrate reports into Power BI.

Method 2: Automating License Cleanup with Microsoft Graph

📌 Use Case: You want to automate the removal of inactive licenses every 60 days.

Step 1: Connect to Microsoft Graph

Connect-MgGraph -Scopes "User.Read.All", "Directory.Read.All", "Reports.Read.All"

Step 2: Gather user sign-in activity

Get-MgUser -All | Where-Object {

$_.SignInActivity.LastSignInDateTime -lt (Get-Date).AddDays(-60)

}

⚠️ Important: Ensure you have the necessary Microsoft Graph API permissions and roles assigned to use this method.

Step 3: Remove or downgrade the license programmatically

Update-MgUserLicense -UserId [email protected] -RemoveLicenses @("tenantname:LICENSE_SKU")

Method 3: Use Group-Based Licensing and Dynamic Groups

📌 Use Case: You want to automate the reassignment of licenses each time an employee shifts roles. This method can help reduce human error in license management and ensure licenses are aligned with the right business roles.

  1. In the Entra Admin Center > Groups, create Dynamic Azure AD group.
    1. Membership rule: user.accountEnabled -eq true and user.department -eq "Sales"
  2. Assign licenses at the group level.
  3. Remove manual license assignments from users.

Method 4: User Registry to Disable Local Office Apps for Unlicensed Users

📌 Use Case: This method ensures only licensed users can access Office applications by blocking access when no valid license is detected.

Registry path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Common\Licensing

– BlockedProducts (String): “ProPlusRetail”

💡 Tip: You can combine group-based licensing with scripting tools to automatically lock apps if a user’s license status fails validation.

Method 5: Use Group Policy to Support Usage Enforcement

📌 Use Case: This method prevents Office use on shared machines without a valid sign-in. It helps support license compliance on RDS, VDI, and similar shared environments.

  1. Navigate to: User Configuration > Administrative Templates > Microsoft Office 2016 > Licensing Settings.
  2. Enable Disable Office activitation if no user license is available.
  3. Enable Do not displace the Office First Run UI.

Method 6: Use CMD for Local User License Checks

📌 Use Case: You want to manually verify a device’s Office status license during remote troubleshooting.

A. Verify Office licensing via command line:

cscript "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" /dstatus

B. Query registry for activation status:

reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Registration

💡 Tip: You can use these commands in login scripts to flag or shut down unlicensed Office instances.

⚠️ Things to look out for

Keep these pitfalls in mind when using this guide:

Risks Potential consequences Reversal
Automating license removal without exception handling or logging. Critical users like executives and service accounts may lose access unexpectedly. Add exception filters and log all actions.
Misconfiguring dynamic group rules. Users may be excluded from license groups and may lose access to essential apps. Review group rules before applying any changes.
Applying registry changes without validating the license status. Licensed users may be blocked from using Office applications on their devices. Verify license status before making any changes to the registry and maintain a rollback script. Make sure to back up the system registry.
Deploying GPOS without testing it on a pilot group. Office activation may be blocked for all users, including licensed ones. Test your GPOs in a controlled OU before deploying them. Document and version GPO changes to make rollback easier.

Troubleshooting guide for managing Microsoft 365 licenses

  • License not removing: Adding the incorrect Microsoft 365 SKU name in your scripts may cause the license removal to fail silently. Ensure the SKU name is typed exactly as it appears in your tenant.
  • Usage report delays: Delays in sign-in and service usage reports for Microsoft 365 are normal. They typically last between 24 and 72 hours, so it’s important you verify that your data is at least 3 days old before applying any changes.
  • Graph API errors: Missing permissions or roles can cause Graph API requests to fail. Make sure all the necessary scopes have been granted and that the user has the appropriate role before running the app.
  • CMD output invalid: Running CMD scripts without administrator privileges may result in incomplete or misleading output. To prevent this, always run PowerShell or CMD scripts as an administrator.

Additional tips for preventing Microsoft 365 license waste

Here are some additional steps you can take to prevent license waste within your organization.

Make the most of licensing alerts

It’s easy to lose track of the number of licenses your organization has. That said, we suggest you set up alerts that notify you when license usage is near or exceeds your thresholds.

Recover or clean up orphaned mailboxes

In some instances, a user’s mailbox will remain open even after they leave the company. These orphaned mailboxes can take up a lot of space and resources, so it’s important to find them as soon as possible.

You can use the Get-Mailbox -InactiveMailboxOnly PowerShell command to locate these mailboxes. From there, decide whether you want to recover them or clean them up for good.

Compare license types against actual usage

Another excellent way to prevent license waste is to compare license types to actual usage patterns. Not everyone needs a premium license, so it’s best to examine who actually needs advanced features and who doesn’t.

You can use tools like Power BI to map out which low-use profiles have high-cost SKUs and adjust them accordingly.

Audit service plans

Consider disabling service plans that your organization rarely uses.

Microsoft 365 typically comes with services like Yammer, Stream, or Sway, which are not widely used. If your organization doesn’t need these services, disable them in bulk.

What causes license waste?

Several factors may cause license waste, but the most common culprits are:

Inactive users holding licenses

These are users who haven’t shown any usage activity in the last 30 days due to offboarding or role changes. The licenses assigned to these users will continue to incur costs unless you reclaim them.

Duplicate or disabled accounts are retaining licenses

These accounts are common in hybrid environments and are typically caused by migration issues.

High-cost licenses are used for basic workloads

These premium licenses are assigned to users who don’t need advanced features. For example, it is not advisable to assign an E5 license to an employee who only uses Outlook and Teams occasionally.

NinjaOne services for effective Microsoft 365 license optimization

NinjaOne can provide an additional layer of automation and visibility for optimizing Microsoft 365 licenses.

NinjaOne Service What it is How it helps 
PowerShell Script Automation Automates and schedules recurring tasks like license reclamation across client tenants. Saves time and ensures consistency across multiple clients.
Custom Reports Tracks license-to-usage correlation at the endpoint and user level. Helps identify underutilized licenses and empowers MSPs to reallocate resources.
Alerts Notifies MSPs if inactive users are detected or license pools are overprovisioned. Enables proactive license management and optimization.
Self-Healing Actions Automatically revokes or downgrades licenses for inactive users. Eliminates the need for manual intervention and reduces license waste by automating corrective actions.
Cross-Tenant Dashboards Centralizes license usage analytics across multiple SMB clients. Provides MSPs with a unified view of all licenses in use across multiple tenants.

These services enable MSPs to turn license analytics into meaningful, actionable strategies.

Reduce Microsoft 365 license spending by leveraging usage analytics and automation

Usage analytics and automations are the two primary tools your organization will need to prevent license waste effectively.

Analytics will provide you with the insights needed to optimize your license spending. It’ll give your team a clear breakdown of which licenses are active, underutilized, or downright wasted.

Meanwhile, automation will help you simplify the process of realigning, removing, and tracking all licenses across all tenants.

Together, they allow your organization to cut unnecessary costs and maintain flexibility as your tenants continue to grow.

Related topics:

FAQs

The 90-day rule in Microsoft Volume Licensing prevents organizations from reassigning licenses to another user or device more than once within 90 days.

No, you generally cannot transfer Office 365 licenses directly from one account to another. However, you can cancel and repurchase an existing license under a new account.

To assign a Microsoft 365 license to a user:

  1. Open the Microsoft 365 admin center.
  2. Navigate to Users > Active users page.
  3. Select the user to whom you want to assign a license.
  4. In the user’s details pane, select Licenses and Apps.
  5. Click the license you wish to assign to the target user.
  6. Select Save changes.

You might also like

Ready to simplify the hardest parts of IT?
×

See NinjaOne in action!

By continuing, you agree to our Terms of Use, acknowledge that the Privacy Notice applies, and consent to receive calls and emails. Consent is not required to purchase.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).