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.

https://gallery.technet.microsoft.com/Get-last-logon-time-for-11e894f5

Hope it helps.

Advertisements