[intranet learning notes] 25. Exchange mail server

Keywords: Cyber Security

1. Basic operations of Exchange

Do the following in PowerShell on the Exchange server

Add the Exchange snap in to the current session

add-pssnapin microsoft.exchange*

View mail database

Get-MailboxDatabase -server "dc"

Query the physical path of the database

Get-MailboxDatabase -Identity 'Mailbox Database 0761701514' | Format-List Name,EdbFilePath,LogFolderPath

Get the email address of an existing user

Get-Mailbox | Format-table Name,WindowsEmailAddress

View the mailbox usage information of the specified user

Get-Mailboxstatistics -Identity Administrator | Select Dispayname,ItemCount,TotalItemSize,TotalTimeSize,LastLogonTime

Get the number of messages in the user's mailbox. Through this command, you can also list those mailboxes in which the user has not logged in

Get-Mailbox -ResultSize Unlimited | Get-Mailboxstatistics | Sort-Object TotalItemSize -Descend

2. Export the specified email address

In Exchange Server 2007, you need to use the ExportMailBox command. In Exchange Server 2010 SP1 and later versions, you can use the graphical interface or PowerShell

If you want to export mail files in PTS format, you need to configure export / export permissions for users.

Configure user import and export permissions

view user permission

Get-ManagementRoleAssignment -role "Mailbox Import Export"

Add the Administrator user to the Mailbox Import Export role group. After adding the user to the role group, you need to restart the Exchange service to perform the export operation

New-ManagementRoleAssignment -Name "Import Export_Domain Admins" -User "Administrator" -Role "Mailbox Import Export"

Delete the user in the Mailbox Import Export role group that you just added

Remove-ManagementRoleAssignment "Import Export_Domain Admins" -Confirm:$false

Set up network shared folders

No matter which method you use to export mail, you need to place the file under the UNC (Universal Naming Convention, also known as Universal Naming Convention) path

Under the network path similar to "\ hostname\sharename" and "\ ipaddress\sharename", sharename is the name of the network share.

First, start sharing, set the inetpub folder of drive C to everyone readable / writable, and execute the following command:

net share inetpub=c:\inetpub /grant:everyone,full

Export user's e-mail

Use PowerShell to export e-mail. The user's e-mail directory is generally Inbox, sent items, deleted items, Drafts, etc

New-MailboxExportRequest -Mailbox administrator -FilePath \\\inetpub\administrator.pst

Export e-mail using a graphical interface, visit , open the login interface of the Exchange management center.

Enter the account and password into the Exchange management center, click More... And select export to PST file to export.

Manage export requests

Whether exported through Powershell or graphically, an alarm message will be generated in Exchange. This information will help BT find abnormal behavior in the server. You can view the previous export request record information through the following command.


Delete the export request completed by the specified user

Remove-MailboxExportRequest -Identity Administrator\MailboxExport

Delete all completed export requests

Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest

Delete all export requests, including completed and failed requests

Get-MailboxExportRequest | Remove-MailboxExportRequest

Reference article:


Original link:


More information, welcome to my WeChat official account: TeamsSix

Posted by ungown_admin on Wed, 24 Nov 2021 01:35:17 -0800