Office 365 Last Logon Date Report / Inactive Account Report

I’ve been wanting an excuse to try developing a GUI in power shell for a while so decided to put together this front end which will check the Office 365 last logon date and time for all users and quickly enable you to see which Office 365 Accounts are inactive.

Office 365 Inactive account report script

When you run the script you will be presented with this form:
Screenshot of powershell form that shows inactive Office 365 Accounts

  1. Enter your Office 365 username and Password and click “Login”.
  2. Wait while the script connects to your Office 365 server and downloads your mailbox information:
    Office 365 Inactive Account Report Data being collected
  3. Review all of your inactive accounts!

You can sort the list by the last logon date and time or the number of days since last logon by clicking on the column headers.

If the user has never logged in they have their last logon date set to 01/01/2000.  This script makes things a little easier than getting too deeply involved in Powershell to discover this useful information.

Download the file from here: 


20 thoughts on “Office 365 Last Logon Date Report / Inactive Account Report

  1. Hello ,

    When I am running this script, my Powershell blinks for a moment and then disappears.. Please let me know that wrong am I doing in this.


  2. I’m not sure why, but I would like to find out. Would you be prepared to do a remote control session with me so I can help you figure it out?

  3. The script will not execute because it is not digitally signed.

    Right click on the file, select properties, then click the Unblock button at the bottom. It will work fine after that.

  4. Is there a way I can get user who has logged in to a particular site in SharePoint online. In our organisation we are not using office 365 mailbox.

  5. This is a great script. I only wish you included a way to export the information it finds to a CSV, Excel file, or Web Page.

  6. Great script! Thanks so much for sharing. We are in the process of rolling out Office 365 and this is a great way to see who hasn’t read our “must sign in email” to test credentials.

  7. Okay, dumb question. Where does it export to? I assumed the same directory as the script was in but I’m not seeing it. From looking at the code, I don’t see an export path so was thinking it would be in the same directory.

  8. I downloaded your zip file, but now what? When I open the ps1 file, it just opens a text file with a bunch of stuff I don’t know what to do with. When I call it from a ps window, I only get “>>” in response.

  9. Hi Paul,
    Very nice script. Is there a way you can add the display name to the output csv file? it would be very nice to the first and last name of the accounts that never have logged in as well as the email address. Thanks!

  10. I love this script. I ran it but cant find the csv file after I exported it. Can you tell me where it is?

  11. Good script.

    If tenant has more than 10000+ users, it takes long time. Is it possible to give input file either .txt or .csv format which contains , only 2000 or 3000 users in the input file. This helps to reduce no.of sessions connecting to Powershell or fix throttling issues.


Leave a Reply

Your email address will not be published. Required fields are marked *