Script
$mb= get-mailboxrecipienttypedetail usermailbox -resultsize unlimited
$rest = @()
foreach($mb1 in $mb){$rest+=Get-MailboxStatistics -Identity $mb1.primarysmtpaddress| select-object displayname,lastlogontime;[System.Threading.Thread]::Sleep(500)}
$gt=get-date
$inactloggin= $rest | where{($_.LastLogonTime -ne $null) -and ($gt.subtract($_.LastLogonTime).days -ge 61 )}
$Nevlog= $rest | where{$_.LastLogonTime -eq $null}
$allinact=$inactloggin + $Nevlog
$allinact | select-object displayname,lastlogontime | export-csv inactiveusers.csv -NoTypeInformation
In Get-mailboxstatisctics, it will not retrieve the UPN and Email address. Need your help to get the output with
UPN, email address , Lastlogontime who didn't access the mailbox older than 60 days.
Regards
Rokinth