Skip to content
Tech Shizz Logo

An Engineers Blog

  • TechShizz
  • blog

Export Office 365 User Last Logon Date to CSV File

Posted on February 23, 2021 By rich No Comments on Export Office 365 User Last Logon Date to CSV File

This script will connect to Office 365 and export a list of all your Office 365 Mailbox enabled users Last Logon Date/Time to a CSV file. It’s useful for finding out if you’re paying for any licences that aren’t being used!

Download

his script will connect to Office 365 and export a list of all your Office 365 Mailbox enabled users Last Logon Date/Time to a CSV file.  It’s useful for finding out if you’re paying for any licences that aren’t being used!

The last logon date relates to the time a user last accessed their mailbox using either Outlook, Web Mail or their mobile phone.

You can choose to either list all users in your Office 365 tenant or use the -InputFile switch to pass a text file with the UserPrincipalName’s of a subset of users for which you want the data.

To run the script from a Powershell window:

 

PowerShell
.Get-LastLogonStats.ps1 -Office365Username [email protected] -Office365Password Password123 -InputFile c:FilesInputFile.txt 
 

NOTE: If you do not pass an input file to the script, it will return the last logon time of ALL mailboxes in the tenant.

Post navigation

❮ Previous Post: Allow Domain Users to install their own printers
Next Post: Office 365: Configuring Malware Filters ❯

Leave a Reply Cancel reply

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

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Subscribe to our newsletter!

Recent Posts

  • How to implement a lightning-fast ransomware playbook
  • How to achieve defence in depth in your business
  • How to implement a SecOps team phishing response plan
  • How to block an Office 365 Sign-in correctly
  • Microsoft finally patched serious Exchange 0-day over a month old!

Recent Comments

    Archives

    • November 2022
    • July 2021
    • March 2021
    • February 2021

    Categories

    • Cyber Security
    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2023 .

    Theme: Oceanly News Dark by ScriptsTown