exchange; mailbox; folders; powershell

All posts tagged exchange; mailbox; folders; powershell

$Mailboxes = Get-Mailbox -id  Deborah_Polen-Pitman
$Results = foreach( $Mailbox in $Mailboxes ){
    $Folders = $MailBox |
        Get-MailboxFolderStatistics |
        Measure-Object |
        Select-Object -ExpandProperty Count

    New-Object -TypeName PSCustomObject -Property @{
        Username    = $Mailbox.Alias
        FolderCount = $Folders
        }
    }

$Results |
    Select-Object -Property Username, FolderCount
Export Mailbox cmdlet example
New-MailboxExportRequest -Mailbox first_last -FilePath d:\first_last.pst
  Import Mailbox cmdlet example
New-MailboxImportRequest -Mailbox first_last -FilePath d:\first_last.pst -TargetRootFolder "RecoveredFiles"