
Export-import mailboxes
Export Mailboxes
New-Mailboxexportrequest -Mailbox UserName -name «user export» -filepath «\\Server\Share$\UserName.PST» (-isArchive) -excludedumpster
Get-Mailboxexportrequest | Format-List
Get-MailboxExportRequest -Status Completed
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
New-MailboxExportRequest -Mailbox username-ContentFilter «(Sent -gt ’11/23/2021 3:00 PM’)» -FilePath \\share\file.pst
New-Mailboxexportrequest -Mailbox username-ContentFilter «(Received -lt ’01/01/2019 0:00′)» -filepath «\\share\file.PST»
Export with content filter
$begin = ‘mm.dd.yyyy’
$end = ‘mm.dd.yyyy’
New-Mailboxexportrequest -Mailbox username -name «Export name» -filepath «\\share\file.PST» -ContentFilter {(Received -lt $end) -and (Received -gt $begin)} -isArchive
ImportMailboxes
New-MailboxImportRequest -FilePath \\esp-ho-ex2010a\pst\alan.reid.pst -Mailbox john.smith
New-MailboxImportRequest -FilePath \\esp-ho-ex2010a\pst\alan.reid.pst -Mailbox john.smith -TargetRootFolder «Mailbox — Alan Reid»
New-MailboxImportRequest -FilePath \\esp-ho-ex2010a\pst\archive.pst -Mailbox alan.reid -IsArchive
New-MailboxImportRequest, {BadItemLimit=50, AcceptLargeDataLoss=True, FilePath=\\share\old_mail.pst, Mailbox=username, IsArchive=True}.
Move-database
Move-Databasepath “Mailbox Database 2018660615″ -EdbFilepath “D:\Exchange Databases\Mailbox Database 2018660615.edb” -LogFolderpath “D:\Exchange Logs”s
Change Folder Permissions for Calendar
Get-MailboxFolderPermission -identity «sotrudnik@office.local:\Calendar»
Add-MailboxFolderPermission -identity «sotrudnik@office.local:\Calendar» -user nachalnik@office.local -AccessRights Editor
Delete content in mailbox
Search-Mailbox adm1 -SearchQuery received<01/01/2019 -DeleteContent
Search-Mailbox -Identity username-SearchQuery «search word»-TargetMailbox username -TargetFolder «folder name» -EstimateResultOnly
Search content in mailbox
Search-Mailbox -Identity username-SearchQuery «Search word» -TargetMailbox username -TargetFolder «Target folder name»-EstimateResultOnly
Search-Mailbox -Identity username -SearchQuery {Subject:»search word» OR body:»search word» and ‘to:user@email.com’ and received:01/01/2011..12/31/2018 and sent:01/01/2011..12/31/2018} -TargetMailbox username -TargetFolder «target folder»
get-mailbox username | search-mailbox -searchquery «(“” OR “” OR “”)» -EstimateResultOnly -targetmailbox username -targetfolder «target folder name»
Search disconnected mailboxes
$dbs = Get-MailboxDatabase
$dbs | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisconnectReason -eq «Disabled»} | Format-Table DisplayName,Database,DisconnectDate
OR
Get-MailboxDatabase «Archive database name» | Get-MailboxStatistics | Where {($_.DisconnectDate -ne $null) -and ($_.IsArchiveMailbox -eq $true)} Format-List
OR
clean-mailboxdatabase -identity «Mailbox name»
OR
Update-StoreMailboxState -Database «archive database name» -Identity «guid»
Get-MailboxDatabase -Identity «archive database name» | Get-MailboxStatistics | Format-List DisplayNam
e, MailboxGuid, Database, DisconnectReason, DisconnectDate
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisplayName -match «Full User Name»} | fl DisplayName, Database, DisconnectDate, DisconnectReason
Connect-Mailbox -Identity ″Test Mailbox Restore″ -Database DB3 -User ″testmailboxrestore″ -Alias ″testmailboxrestore″
Move mailbox to another database in another domain
New-MoveRequest -Identity username -TargetDatabase «Database name» -Remote -RemoteHostName «remote host name» -RemoteCredential (Get-Credential) -TargetDeliveryDomain «remote domain name»
Tracking log
Get-Messagetrackinglog -Recipients:»user@email.com» -Start «06/03/2019 1:00:00 AM» -End «06/0
4/2019 1:00:00 AM» -Sender «user@email.com» | fl
Transport config
Get-TransportConfig | Format-List MaxReceiveSize,MaxSendSize,MaxRecipientEnvelopeLimit
Update address books
Get-AddressList | Update-AddressList
Get-GlobalAddressList | Update-GlobalAddressList
Get-OfflineAddressBook | Update-OfflineAddressBook
Get-OfflineAddressBook | fl Name,LastTouch*
Update-OfflineAddressBook -Identity «address book name OAB»
Set-GlobalAddressList -Identity «GAL name» -RecipientFilter {(Company -eq ‘company name from AD user settings’) -and (Alias -ne
$null)}
Create file with all smtp addresses
Get-recipient | select -expand EmailAddresses | %{$_.SmtpAddress} | sort >> c:\smtp_address_list_sorted.txt
Managed Folder Assistant
Get-Mailbox | Start-ManagedFolderAssistant
Start-ManagedFolderAssistant -identity username
Repair mailbox
New-MailboxRepairRequest -Mailbox ayla -CorruptionType ProvisionedFolder,SearchFolder,AggregateCounts,Folderview -Archive
Add user group for delegation user rights
$mbx=Get-mailbox -RecipientTypeDetails UserMailbox -ResultSize unlimited
foreach($mb in $mbx) {Add-MailboxPermission $mb.Alias -User «domain\groupname» -AccessRights Fullaccess -AutoMapping:$false}
Show user status quarantine
Get-MailboxStatistics -Identity userlogin | fl *isquarantined*
Show offline exchange components
Get-HealthReport ex11 | where { $_.state -eq «Offline»}
Get-ServerComponentState -Identity servername
Set-ServerComponentState -Component EwsProxy -Identity servername -Requester HealthApi -State Active