get-O365InactiveUsers

3.4

This script will generate a HTML file to list all inactive users and the last logon of users based on the audit log.
Inactive users will normally be collected using the users mailbox but external and users without a license don't have a mailbox.
We will be using the audit log to find successful and failed logons for internal users and page viewes for external users.
I
This script will generate a HTML file to list all inactive users and the last logon of users based on the audit log.
Inactive users will normally be collected using the users mailbox but external and users without a license don't have a mailbox.
We will be using the audit log to find successful and failed logons for internal users and page viewes for external users.
It will take around 6-8 seconds per user as we are querying the log for each user.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name get-O365InactiveUsers

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deloy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Author(s)

Maarten Peeters - Cloud Securitea - https://www.cloudsecuritea.com

Owners

Tags

office365 inactive users audit AAD Azure Active Directory

Functions

Invoke-ExoOnlineConnection

Dependencies

This script has no dependencies.

Release Notes

Version 1.0: Original published version.
Version 2.0: Updated a few comment sections.
Version 3.0: Changed the example.
Version 3.1: Added AdminUPN parameter as Exchange Online otherwise closes the connection after 1 hour.
Version 3.2: Changed parameter name
Version 3.3: Updated a few comment sections.
Version 3.4: Added script from https://techcommunity.microsoft.com/t5/Exchange/60-minutes-timeout-on-MFA-Session/m-p/559224 to counter the timeout

Version History

Version Downloads Last updated
3.4 (current version) 25 9/19/2019
3.3 8 9/19/2019
3.2 5 9/19/2019
3.1 6 9/19/2019
3.0 5 9/18/2019
2.0 5 9/18/2019
1.0 6 9/18/2019