Hi, When you try to combine Get-mailbox with Get-MailboxStatistics and export it to csv-file, You will get nothing from the last command. So here is a script that will allow You export the following. From Get-Mailbox = Name From Get-Mailbox = UserPrincipalName From Get-Mailbox = Alias From Get-MailboxStatistics = LastLogonTime From Get-MailboxStatistics = LastLogofTtime From Get-MailboxStatistics = Servername From Get-MailboxStatistics = Databasename
$DataPath = "C:\folder\Mailboxes.csv" $Results = @() $MbxUsers = get-mailbox -resultsize unlimited foreach($user in $mbxusers) { $UPN = $user.userprincipalname $Mbx = Get-MailboxStatistics $UPN $Properties = @{ Name = $user.name UPN = $UPN Alias = $user.alias Logon = $Mbx.lastlogontime Logoff = $Mbx.lastlogofftime Server = $Mbx.servername DatabaseInstructions = $Mbx.databasename } $Results += New-Object psobject -Property $properties } $Results | Select-Object Name,UPN,Alias,Logon,Logoff,Server,DatabaseInstructions | Export-Csv -nti -enc utf8 -Path $DataPath

Archives