For a while I've been thinking I want to automate cleaning up the E3/E5 license usage. I want to look at the user activity on various platforms such as Exchange Online, Sharepoint Online, Teams and so on and if there has been no activity for like 3 months and the license wasn't recently assigned (new user), I want to remove the license.
Removing the license is easy enough. I also have the data I need from the Microsoft 365 Admin Portal with the reports for usage (https://admin.microsoft.com/Adminportal/Home?source=applauncher#/reportsUsage). However I can't seem to find any documentation on how to extract the usage by PowerShell. Is there anyone who has done this and can help me get started?