Updated 3 months ago

Export Office 365 License Expiry Date Report to CSV using PowerShell

by Kathy Cooper

6 min read

No Comments

Each Office 365 subscription has a set of services and applications that can be purchased for on either a monthly or an annual basis. When you buy a subscription, you can specify the number of licenses needed based on the people in your organization. When the license expires, you need to renew those license plan, else you will end up losing access/data. So, how will you find Office 365 subscription expiry date?

How to view Microsoft 365 License Expiration Date:

You can check the license expiry date using any of the following methods.

  1. Check Office 365 license expiry date from Microsoft 365 Admin Center
  2. Get Office 365 license expiration date using PowerShell

In the Admin Center, you need to navigate to Billing–> Products & Services. It will show Office 365 subscription plan, expiry date.

If you are a hater of ever-changing admin portals, I’d suggest you use PowerShell. Before jumping into that, if you want to know more about Office 365 licensing, please refer to the bottom of this blog for FAQs.

How to Check Office 365 License Expiry Date using PowerShell

You can use the ‘Get-MgSubscribedSKU‘ cmdlet to retrieve license-related information, but it will not provide the expiry date. To get the next lifecycle date, you need to use either ‘Get-MgDirectorySubscription‘ or a Graph API call. However, the cmdlet returns results in an unfriendly format. For instance, the license name is displayed as an SKU rather than a user-friendly name, requiring additional handling to format the result properly. This is exactly where our PowerShell script comes in handy.

Script Highlights:

  • Exports Office 365 license expiry date with ‘next lifecycle activity date’.
  • Exports report to the CSV file.
  • Result can be filtered based on subscription type like Purchased, Trial and Free subscription
  • Result can be filtered based on subscription status like Enabled, Expired, Disabled, etc.
  • Subscription name is shown as  user-friendly-name like ‘Office 365 Enterprise E3’ rather than ‘ENTERPRISEPACK’.
  • The script can be executed with MFA enabled account too.
  • Supports certificate-based authentication too.
  • The script is scheduler friendly.

Download Script: LicenseExpiryDateReport

M365 Subscription Expiry Date Report- Sample Output

The exported subscription expiry date report contains the following attributes: Subscription Name, Friendly Subscription Name, Subscribed Date, Subscription Type, Next Life Cycle Activity Date, Friendly Expiry Date, Subscription Status.

The output looks similar to the screenshot below.

Check Microsoft 365 license expiry date using PowerShell

How to Execute ‘Office 365 License Expiry Date’ PowerShell Script:

To view licenses expiry date for all licenses, run the script as follows.

The result will list all Office 365 subscriptions with their subscribed date and expiry date. Using this report, you can renew the subscription before it expires.

How can I Filter the Output?

You can use params/switches to get a more granular Office 365 subscription expiration report. I have given some of the use-cases of this script.

  • List all O365 subscription plans and their details
  • Export Office 365 Trial subscriptions
  • Get a list of free subscriptions in your organization
  • Export all purchased subscriptions
  • Export Office 365 expired subscription report
  • Get all active subscriptions
  • Schedule ‘Office 365 subscription expiry report’

Export Office 365 Subscription Information Report:

Most admins have this question – ‘what Office 365 subscription do I have?’. Office 365 subscription information report gives detail about Office 365 plan, expiry date, when Microsoft charges for renewal, license status, etc.

To get this report, run the script as follows:

You can also refer to the Office 365 license report to get a list of licensed users with their assigned licenses.

Export Office 365 Trial Subscriptions Report:

You can use this report to get a list of free trial subscriptions in your organization. By referring to this report, you can cancel the trial or extend your trial period before it expires.

To get trial subscriptions in your tenant, execute the script with –Trial switch parameter.

Export Office 365 Free Subscription Report:

Users in your company can activate free subscriptions. Any individual can gain access to some subscriptions like ‘Microsoft Power Apps’ without admin approval. This option available to all users, and admin can’t disable it.

To get free subscriptions in your organization, you can execute this script with –Free switch.

Export Office 365 Purchased Subscription using PowerShell:

By viewing the subscription expiry date/next life cycle activity date, you can change the ‘recurring billing settings’ to yearly or once, or you can turn off the renewal. You can also cancel the purchased subscription if needed.

To get a list of paid subscriptions, run the script with –Purchased switch.

You can also refer to the Microsoft 365 license cost report to identify the total cost spent on Microsoft 365 subscriptions.

Get a List of Active O365 Subscriptions:

While the subscription is active, admins and end-users have regular access to data, services, and Office applications. Once it crosses the active state/expires, access is restricted.

To get active subscriptions report, you can use –Active switch.

Using this report, you can check the subscriptions’ expiration status. Sometimes, users end up with duplicate licenses when they receive the same license assigned both directly and through groups. In that case, you can refer the user license assignment paths report to remove the duplicated ones.

Find out Office 365 Expired Subscriptions:

As an admin, you will receive a series of license expiry notification via email and admin center. When the subscription expires, your access to Office 365 gets restricted. For more detail, you can check what happens when Office 365 license expires.

To get the expired subscriptions, execute the script with –Expired switch.

With this report, you can reactivate the disabled Office 365 subscription.

Get more Granular Office 365 License Expiration Report:

To get a more granular report, you can use multiple filters i.e., switch parameters

Above report contains both trial and free subscriptions.

Above report lists all expired subscription which was purchased. i.e., it excludes free and trial subscriptions.

Schedule Office 365 Subscription Expiry Report:

As said earlier, this script is scheduler friendly. You can schedule the script in Azure Automation using certificate based authentication.

Note: You can either use CA certificate or create a self-signed certificate based on your requirements.

Get O365 License Reports for Free with AdminDroid:

Why AdminDroid is top choice for Microsoft 365 license reporting?
  • Schedules and sends reports to email
  • Exports data in various formats, such as CSV, HTML, PDF, etc.
  • Filters data to generate fine-grained reports
  • Visualizes report data to charts/AI generated graphs
  • Manages multiple tenants
  • User friendly UI
  • License and other 120+ Azure AD reports available in Free Edition itself.

AdminDroid offers a free Office 365 reporting tool that provides detailed license usage reports and smart dashboards. License reports are categorized based on

  • Users’ License expiry Status
    • Purchased subscription expiring users
    • Purchased subscription expired users
    • Trial expiring/expired users
    • Users with suspended subscription
  • Subscription
    • Subscription usage report
    • Expired subscription
    • Unused subscription
    • Purchased subscription
    • Trial subscription
  • Users and Licenses
    • Licensed users
    • Unlicensed users
    • Users with specific subscription
    • Users with free/trial subscription
  • Regainable licenses
  • License assignment and removal audit report

Office 365 license dashboard by AdminDroid

Microsoft 365 subscription dashboard by AdminDroid

Office 365 license usage report by AdminDroid

In addition, AdminDroid offers 1800+ reports and 30+ smart dashboards that provide valuable insights into various aspects of your Office 365 environment, such as reporting, auditing, analytics, usage statistics, security, and compliance. Whether you need to monitor usage statistics, track security compliance, or generate detailed reports on your Office 365 environment, AdminDroid has you covered.

Download AdminDroid Office 365 reporting tool now and transform your Microsoft 365 management experience!

FAQs:

What Happens When Office 365 License Expires?

When Office 365 subscription expires, it goes to 3 stages that restrict user and admin access gradually. These periods help customers to reconsider their subscription renewal.

  • Stage 1 – Warning: When your subscription expires, it enters to ‘Warning’ state where users/admins can have unrestricted access to office 365. It lasts for 30 days
  • Stage 2 – Suspended/Disabled: Once the warning period is over, it goes to the ‘Suspended’ state. It lasts for 90 days, I.e., till 120 days from the expiry date. In this period, users can’t access to anything; admins can access data but can’t assign licenses to users. The global admin can reactivate the subscription if needed.
  • Stage 3 – Deleted/Deprovisioned: Once the suspended period is over, it moves to the ‘Deprovisioned’ state. In this stage, admins lose access to data, and Microsoft starts to delete data from its server. You can’t renew or reactivate the subscription once it reaches a deprovisioned state. If you want to use this subscription/service, you need to purchase a new one.

Can I still use Office 365 After Subscription Expires?

Yes. You can use Office 365 even after subscription expiry. Microsoft gives a grace period of 30 days, where everything works as an ‘Active subscription’.

The below table describes what you can expect when a paid Office 365 business subscription expires.

license expiry date powershell

When does Microsoft Charge for Subscription Renewal?

Based on ‘recurring billing’ settings, Microsoft charges for renewal. If you see ‘renews on’ near the subscription, you will be charged for subscription renewal on the specified date.

subscription expiry date powershell

Through ‘Recurring billing settings’, you can check Office 365 renewal status. If you don’t want to renew the subscription, you can turn off the recurring billing and let your subscription expire on its expiration date.

I hope this blog is helpful to know your organization’s subscription plans, license expiry date, and some FAQs related to subscription expiry.

Share article