Windows 2022
Sponsored Link

DNS Server : Add MX record2021/12/23

 
Add MX record to define Mail Server to use.
On CUI configuration, Run PowerShell with Admin Privilege and Configure like follows.
[1] For example, Add MX record with settings of hostname [rx-8] into a Zone [srv.world] as Mail exchanger.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# for [-Preference], specify priority of mail Server (default is [10])
PS C:\Users\Administrator> Add-DnsServerResourceRecordMX -Name "rx-8" -MailExchange "rx-8.srv.world" -ZoneName "srv.world" -Preference 10 -TimeToLive 01:00:00 -PassThru 

HostName                  RecordType Type       Timestamp            TimeToLive      RecordData
--------                  ---------- ----       ---------            ----------      ----------
rx-8                      MX         15         0                    01:00:00        [10][rx-8.srv.world.]

PS C:\Users\Administrator> Get-DnsServerResourceRecord -ZoneName "srv.world" | Format-Table -AutoSize -Wrap 

# MX record has beed added
HostName RecordType Type Timestamp TimeToLive RecordData
-------- ---------- ---- --------- ---------- ----------
@        NS         2    0         01:00:00   rx-7.srv.world.
@        SOA        6    0         01:00:00   [5][rx-7.srv.world.][hostmaster.srv.world.]
rx-7     A          1    0         01:00:00   10.0.0.101
rx-8     A          1    0         01:00:00   10.0.0.102
rx-8     MX         15   0         01:00:00   [10][rx-8.srv.world.]

# if remove it, run like follows
PS C:\Users\Administrator> Remove-DnsServerResourceRecord -ZoneName "srv.world" -RRType "MX" -Name "rx-8" -PassThru 

Confirm
Removing DNS resource record set by name rx-8 of type MX from zone srv.world on RX-7 server. Do you want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):  Y

HostName                  RecordType Type       Timestamp            TimeToLive      RecordData
--------                  ---------- ----       ---------            ----------      ----------
rx-8                      MX         15         0                    01:00:00        [10][rx-8.srv.world.]
DNS Server : Add MX record (GUI)
 
On GUI configuration, set like follows.
[2] Run Server Manager and select [Tools] - [DNS], next right-click the own domain name to show menu on the left pane, then select [New Mail Exchanger(MX)...].
[3] Input Hostname and FQDN of Mail exchanger like follows.
[4] A new Mail exchanger record has beed just added.
Matched Content