Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

Export Office 365 User Last Logon Date to CSV File

2014-01-18 · Posted in Office365

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!

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:

.\Get-LastLogonStats.ps1 -Office365Username admin@xxxxxx.onmicrosoft.com -Office365Password Password123 -InputFile c:\Files\InputFile.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.

Leave a Reply