How To Export Windows IIS SMTP Relay Restrictions List

Query King | Mon, 06 May 2019 at 10:07 hours | Replies : 2 | Points : 100

Category : MicroSoft IIS


Hi Team,

 

Please share the command or utility to export Windows IIS SMTP relay restrictions list.

 


This Question is already solved Click To See The Answer


Hi,


“To Export Windows IIS SMTP Relay Restrictions List”. First install “IIS Management Scripts and Tools” on the SMTP server as given below, so that server has required WMI classes.

1. Login to Windows SMTP Server with Administrative privileges.
2. Click Start, click Administrative Tools, and then click Server Manager.
3. In the navigation pane, expand Roles, right-click Web Server (IIS), and then click Add Role Services.
4. In the Select Role Services pane, scroll down to Management Tools.
5. Click to select the IIS Management Scripts and Tools, IIS 6 Management Compatibility check boxes.
6. In the Select Role Services pane, click Next.
7. In the Confirm Installations Selections pane, click Install.
8. Click Close to exit the Add Role Services wizard.

 

Once Installation completed, Run the below PowerShell command to get the list.

$SMTP = Get-WmiObject IISSmtpServerSetting -namespace "ROOT\MicrosoftIISv2" | Where-Object { $_.name -like "SmtpSVC/1" }
$RelayIPList = @()
For ($CurrentIt = 0; $CurrentIt -lt $SMTP.RelayIpList.Count; $CurrentIt += 4) {
$EndIndex = $CurrentIt + 3
$RelayIPList += $SMTP.RelayIpList[$CurrentIt..$EndIndex] -join "."
}
$RelayIPList = $RelayIPList[20..($RelayIPList.Count - 1)]
$RelayIPList > RelayIPList.txt

Hope it will help you.

 

 

Thanks Santosh,

 

Its perfect script and got expected output.