简体   繁体   中英

How to get inactive days from user's last logon time?

I need to export all inactive users in Office 365 with their inactive days.

I used Get-MailboxStatistics command, but using that I could get only last logon time but not inactive days.

Can anyone suggest command to get inactive days?

There is no direct command to get inactive days. you can use New-TimeSpan command to get number of days. For eg, if last logon time stored in lastlogontime variable,

    $InactiveDays=(New-TimeSpan -Start $lastLogonTime).Days

Hope this might resolve your problem!!

By using the Get-MailboxStatistics command, you can get the last logon time alone.

You could try this pre-built script to export all office 365 inactive users with Inactive days, Last logon time, etc. : https://o365reports.com/2019/03/07/export-office-365-users-last-logon-time-csv/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM