简体   繁体   English

如何从用户上次登录时间获得非活动天数?

[英]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.我需要导出 Office 365 中所有非活动用户及其非活动天数。

I used Get-MailboxStatistics command, but using that I could get only last logon time but not inactive days.我使用了Get-MailboxStatistics命令,但使用该命令我只能获取上次登录时间而不是非活动天数。

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.您可以使用 New-TimeSpan 命令获取天数。 For eg, if last logon time stored in lastlogontime variable,例如,如果上次登录时间存储在 lastlogontime 变量中,

    $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.通过使用 Get-MailboxStatistics 命令,您可以单独获取上次登录时间。

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/您可以尝试使用此预构建脚本导出所有具有非活动天数、上次登录时间等的 Office 365 非活动用户: https : //o365reports.com/2019/03/07/export-office-365-users-last-登录时间-csv/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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