Exchange 2010/2013/2016:- Get last logon time for mailbox in an OU
In exchange, many commands are directed at all mailboxes in the environment, but there is a time when you only want info on a specific organizational unit (OU).
It is actually very easy to do, below is a snippet of a script you can use to get the last logon information for an OU which also lists things like the Mailbox Size, Last Logon Date etc.
It outputs to a CSV file, I saved the data as and Excel workbook and this is what it looks like:
You can head over to the gallery here and grab the PS1 script.
In the script on line one in inverted commas “”, put the attribute of the OU in and on the last line, specify where you want the csv file to export to.
Hope it helps.