Delete database
get-moverequest -sourceDatabase "database name"
Delete the database: Get-moverequest -targetdatabase "database name"
Delete mobile database
remove-moverequest "database name"
Configure POP and IMSP
When creating pop3 or IMAP is unsuccessful, you can use the following command: get-servercomponentate -identity "mail server name"
Use the following command to activate the components whose State is not Active:
Set-ServerComponentState -Identity “mail01” -Component PopProxy -Requester HealthApi -State Active
What is the way to do the encryption method of Pop3:
Set POP3 and IMAP4 incoming properties in EMS
Set-PopSettings -ExternalConnectionSettings {"Mail Domain":995:SSL}
Set-ImapSettings -ExternalConnectionSettings {<server FQDN>:993:SSL}
The complete command: Set-PopSettings -ExternalConnectionSettings "mail.contoso.com:995:SSL","mail.contoso.com:110:TLS" -X509CertificateName mail.contoso.com
Use the following command to verify that Exchange has been configured to allow users to view their POP3 and IMAP4 server settings
Get-Popsettings | fl
Get-Imapsettings | fl
Allow Outlook web app to view smtp
Get-ReceiveConnector "*Client Frontend*" | Set-ReceiveConnector -Fqdn Server.Contoso.com -AdvertiseClientSettings $true
The command to start pop3 of a certain user:
Set-CASMailbox -Identity "John Smith" -POPEnabled $true
Command to ban a user’s pop3:
Set-CASMailbox -Identity "John Smith" -POPEnabled $false
Get mail group members:
Get-DistributionGroupMember -identity "dyxnet" | Export-Csv d:\dyxnet.csv
Get all members:
Get-user -ResultSize unlimited| Export-Csv d:\all.csv -Encoding "utf8"
Mail tracking:
Get-MessageTrackingLog -server dag01 -ResultSize Unlimited -Start "8/26/2015 4:24PM" -End " 8/26/2015 4:27PM" -Sender [email protected]
Mail deletion (be careful to use):
search-mailbox -identity [email protected] -searchquery subject:"Mail subject" -deletcontent
Get all personnel in the user database, size:
Get-Mailbox -Database demo1| Get-MailboxStatistics |sort totalitemsize -desc |ft displayname,totalitemsize,itemcount > d:demo1
Delete the mailbox to restore the data of the mail:
Search-Mailbox zhang.san -SearchDumpsterOnly -DeleteContent
View user mailbox database information:
Get-MailboxStatistics zhang.san | fl
Refresh database command:
Get-MailboxStatistics -Database "UserDB09" | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }
Get the created mailbox
Get-Mailbox | FL Name,RecipientTypeDetails,PrimarySmtpAddress
To move mailbox users to another database:
Elevate the operation authority of all users in the specified database:
Get-mailbox -Database "database name" | add-mailboxpermission -user domain name\administrator -accessRights fullaccess -InheritanceTyer all
Move command:
new-moverequest -Identity "mail user" -TargetDatabase "database name"
Export accounts or users that have not logged in for 30 days Unlimited (Unlimited)
Get-Mailbox -ResultSize Unlimited| Get-Mailboxstatistics | where-object {$_.LastLogonTime -lt (get-date).AddDays(-30)} |select DisplayName,TotalItemSize,LastLogonTime | Export-Csv d:\Disablemailinfo.csv -Encoding utf8
Configure the connector
Set-ReceiveConnector -Identity "Connector Name" -MaxInboundConnectionPerSource unlimited
get-mailbox -server "ff" | move-mailbox –targetdatabase fg
fg is the name of the target database ff is the source server maxthreads (10) 10 threads can migrate up to 30
Get-User -OrganizationalUnit 'domain/OU' | New-MoveRequest -TargetDatabase 'MailDB' -BatchName 'Batch 1'
'domian/OU' is the OU you need to migrate, and it needs to be written in its entirety. 'MailDB' is the target store for mailbox migration, and'Batch 1'is the batch name for this batch of migrated mailboxes.
All mailboxes in the OU HR are migrated to the 13mailDB01 database of Exchange2013, you can enter the following commands in EMS:
Get-Mailbox -OrganizationalUnit ‘HR’ -ResultSize Unlimited | New-MoveRequest –TargetDatabase ‘13mailDB01’ -BadItemLimit 50
This command uses powershell redirection to query all the mailboxes in the HR OU, and then migrate them to Exchange 2013 one by one
Move command:
New-moverequest -Identity "mailbox name" -TargetDatabase "target mailbox database name"
Used in Exchange command line search
Commands for query in Exchange:
Get-addressList
Get-addressList | ft name,*ver* (Get address list)
Get-command *filter*
Get-mailbox administrator | fl
Get-mailboxStatistics administrator
Get-mailboxStatistics administrator|fl (Get the mailbox administrator)
Get-exchangeserver checks how many mail servers are online
Command to list all email accounts: Get-mailbox -filter *
Statistics of all mailbox accounts: (Get-mailbox -filter *).count
Command prompt
Nslookup
Next step:
Enter its command
As a result, the command can be found
Its input set type=mx
Qr-tech.com.cn
https://testconnectivity.microsoft.com/tests/o365 (This website can test the Internet mail connection)
Get-exchangeserver can see that there are two versions of Exchange servers.
Exchange batch migration of users to the specified mailbox database
Import-Csv -Path d:\user.csv New-MoveRequest –Identity $_.name -TargetDatabase 'mailbox1'
First, it is easy to migrate all mailboxes from one database to another database. You only need to output the result of the Get-MailboxDatabase command to New-MoveRequest through the pipeline (Pipe) technology. Examples are as follows:
Get-Mailbox –Database“Mailbox Database 001”| New-MoveRequest –TargetDatabase “Mailbox Database 002”
Give users the right to import and export mailboxes
New-managementRoleAssigment -name "Import Export_domain Admins" -user Domain Management Username -role "mailbox Imort Export"
View the statistics of a mailbox
Get-mailboxstatistics -Identity “test” | fl
View statistics of all users in a database
Get-mailboxStatistics -database “mailbox database 195465” |fl
Suspend-MailboxDatabaseCopy –Identity MDB02\E14EX02 (暂停)
Resume-MailboxDatabaseCopy –Identity MDB02\E14EX02
Set SMTP outgoing properties in EMS
Get-receiveConnector “*client frontend*” | set-receiveconnector -Fqdn <serverFQDN>-AdvertiseClientSettings $true
Use the following command to verify that Exchange has been configured to allow users to view their SMTP server settings. If the
AdvertiseClientSettings property is set to true, users can view their SMTP server settings in OWA
Get-receiveconnector | fl
To apply these changes, IIS needs to be restarted
Run the command as an administrator: iisreset
Allow end users in Outlook Web App to view POP3, IMAP4, and SMTP server settings
Use the following command to check whether the email account is disabled.
Get-CASMailbox username | fl Name,OWAEnabled
User’s OWA and check again
Set-CASMailbox username-OWAEnabled:$true
Get-CASMailbox username | fl Name,OWAEnabled
Query users who have not configured mailboxes in an organization:
get-user -recipientypedetails user -organizationlunit demo
get-user -recipientypedetails user -organizationlunit demo |enable-mailbox
Command to set the size of email sent and received by the user to 20MB:
Get-mailbox -resultsize unlimited | set-mailbox -maxsendsize 20MB -maxreceivesize 20MB
Clear the current size limit for all users
Get-mailbox -resultsize unlimited | set-mailbox -maxsendsize unlimited -maxreceivesize unlimited
Archive configuration
Start the archive function: enable-mailbox demo1 -archive (check whether the user exists before starting: get-mailbox demo1)
Check whether the archive function is successfully turned on: get-mailbox demo1 | fl name “archive”
Command to archive all users: get-mialbox | enable-mailbox -archive
View the archive quota of the user archivequota (the size of the archive quota is unlimited, and the archivewarningquota will alert as much as possible)
Get-Mailbox demo1 | select displayname,archivequota,archivewarningquota
Set quota size:
Set-Mailbox demo1 -ArchiveQuota 10gb -ArchiveWarningQuota 5gb
View the quotas of all users:
Get-Mailbox | select archive* | fl
Command to set quotas for all user archives:
Get-Mailbox |Set-Mailbox -ArchiveQuota 10gb -ArchiveWarningQuota 5gb
Statistics of the number of commonly used mailboxes
Command to query Exchange server: get-exchangeserver
Command to query the database: get-maildatabase
(get-maildatabase).count count the number of databases
Command to query users who have not logged in for 30 days:
Get-Mailbox | Get-MailboxStatistics |Where-Object {$_.lastlogontime -lt (get-date).adddays(-30)}
Query users created within seven days
Get-Mailbox | Where-Object {$_.whencreated -ge ((get-date).adddays(-7))}
Query month
Get-Mailbox | Where-Object {($_.whencreated).month -eq 10 }
Query year
Get-Mailbox | Where-Object {($_.whencreated).year -eq 2020 }