I’m trying to work out how to get an output of the number of active and inactive O365 Users from a Tenant.
All I need is the total number of active (have logged on within the last 30 days) and inactive (have not logged on within the last 30 days) Users,
I know how to pass credentials to O365 tenant using PowerShell.
I know how to get a csv out of the O365 Tenant with the UserPrincipalName and LastLogonDate. If fact I used the script from here to achieve that. https://gallery.technet.microsoft.com/office/Export-Office-365-User-7fc0b73f
This needs to be automated so that on the last day of the month it is ran and the output sent via an email to a non technical person. For that I’ll use Task Scheduler and a service account. They do not want a CSV file, just the two numbers.
Is there something already out there that I’ve not been able to find, or will I need to use something like an “if, else if, else” statement or a ForEach Object command?
Sorry if this seems simple to you but I’m still trying to learn.
Kind Regards, Darren