Forum Discussion

Gwendot's avatar
Gwendot
Copper Contributor
Jan 21, 2020

Help cannot fin cmd

Hi,

I try to get some data from Office 365 usage, that are not available in Microsoft 365 Usage Analytics.

Which cmd powershell will Get me the mailboxes that did not logon since 3 month? 6 month? 12 month? (I do not want to fixe a specific date)? Which cmd powershell will Get me the number of generic Mailboxes ? The number of Mailboxes without any License ? Number of account without License ? The number of Mailboxes per License (E1, E3...) ? State of Accounts ? State of Licenses and date of renewing ? Top 10 target spam users ? Who are the spamers ?

 

I tried this to get the mailboxes that did not logged since the date. But, I do not want a fixed date. I want it for every 3 last month for example. I try to automatize

Get-Mailbox | Get-MailboxStatistics | Where-Object {$_.LastLogontime -lt "09/01/2019"} | Select DisplayName | Out-File C:\Users\GIDOT\AuditLogonMailboxApria.xls

Thanks in advance for any help.

1 Reply

  • Get-Mailbox | Get-MailboxStatistics | Where-Object {$_.LastLogontime -lt ((get-date).addmonths(-3))}

    The [datetime] object has many methods available.  By adding a negative number, you're going "back in time".

     

    AddDays
    AddHours
    AddMilliseconds
    AddMinutes
    AddMonths
    AddSeconds
    AddTicks
    AddYears

Resources