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.

Exchange 2019:- how do i open the exchange management shell on windows server 2019 core?

It outputs to a CSV file, I saved the data as and Excel workbook and this is what it looks like:

Exchange 2019:- how do i open the exchange management shell on windows server 2019 core?

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.

Discover more from Everything-PowerShell

Subscribe now to keep reading and get access to the full archive.

Continue reading