report

Hi

please do help me to generate report, who have last logged into exchange, i need samaccountname also,I am using Exchange Server 2013.

I am trying to run this report but it doesnot show

Get-MailboxStatistics -Database "MyExchangeDB" | Select DisplayName, SamAccountName, LastLogged
OnUserAccount, ItemCount, TotalItemSize, LastLogonTime |  Export-CSV C:\mailbox.csv 

please do help me to add email address in this report and also enabled users in active directory



May 20th, 2015 1:59pm

Hi Risingflight,

Try the following command :

foreach($users in Get-ADuser -filter *){
$users | Foreach-Object {
    $user = $_
    $stats = Get-MailboxStatistics $user.Name
    New-Object -TypeName PSObject -Property @{
        DisplayName = $stats.DisplayName
        SamAccount = $user.SamAccountName
        LastLoggedOnUserAccount = $stats.LastLoggedOnUserAccount
        ItemCount = $stats.ItemCount
        TotalItemSize = $stats.TotalItemSize
        LastLogonTime = $stats.LastLogonTime
        
    }
}
}

Best re

Free Windows Admin Tool Kit Click here and download it now
May 21st, 2015 5:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics