Quantcast
Channel: Exchange Server 2013 - Setup, Deployment, Updates, and Migration forum
Viewing all articles
Browse latest Browse all 7129

Exchange 2013 Application Relay Receive Connector Script

$
0
0

I created this script to creation application relays on each 2013 CAS server based on some settings that Elan Shudnow wrote in an article. I am still working on some pieces to this, such as importing a csv for multiple remote IPs.

<#

.Description
This script is to create application receive connectors across all Exchange 2013 CAS servers.

.Variables
The variables set in this script are based on application relays with high mail volume as described in Elan Shudnow's article

http://www.shudnow.net/2013/06/04/how-anonymous-relay-works-in-exchange-2013/#idc-container

Modify these variables for your deployment:

$FQDN - Modify your EHLO/HELO FQDN
$RemoteIP - Please add a remote IP to create this connector. I will be adding import CSV capability later for larger lists.

#>

#Connector Variables

$ServerNames = Get-ExchangeServer | Where {($_.AdminDisplayVersion -like "Version 15*") -And ($_.ServerRole -like "CLientAccess*")}
$Bind = "0.0.0.0:25"
$Auth = "TLS"
$FQDN = " "
$RemoteIP " "
$ConnectivityTO = "00:20:00"
$ConnetionTO = "00:30:00"
$MaxAckDelay = "00:00:00"
$MaxInConnect = "10000"
$MaxInPercent = "100"
$MaxConnectSource = "Unlimited"
$TarpitInterval = "00:00:00"

# Function to sleep the process

Function Sleep_Progress {
    Param($SleepTime)
    # Loop Number of seconds you want to sleep
    For ($i=0;$i -le $SleepTime;$i++){
        $TimeLeft = ($SleepTime - $i);
        # Progress bar showing progress of the sleep
        Write-Progress "Sleeping" "$Timeleft More Seconds" -PercentComplete (($i/$SleepTime)*100);
        If ($i -lt $SleepTime){Sleep 1}
    }
}

#Create Receive Connector and add AD permissions for SMTP Relay

ForEach ($ServerName in $ServerNames)

{
    Write-Host "Creating Connector on", $ServerName.Identity -ForegroundColor Green

    $RelayName = "Application Relay $Servername"

    New-ReceiveConnector -Name "$RelayName" -Server $Servername.identity -bindings $bind -RemoteIPRanges $RemoteIP -AuthMechanism $Auth -FQDN $FQDN -permissiongroups AnonymousUsers -ConnectionInactivityTimeout $ConnectivityTO -ConnectionTimeout $ConnetionTO -MaxAcknowledgementDelay $MaxAckDelay -MaxInboundConnection $MaxInConnect -MaxInboundConnectionPercentagePerSource $MaxInPercent -MaxInboundConnectionPerSource $MaxConnectSource -TarpitInterval $TarpitInterval

    Sleep_Progress 10

    Write-Host "Adding Relay Permissions on", $ServerName.Identity -ForegroundColor Green

    Get-ReceiveConnector -identity "$Servername\$RelayName" | Add-ADPermission -User “NT AUTHORITY\ANONYMOUS LOGON” -ExtendedRights “Ms-Exch-SMTP-Accept-Any-Recipient”
}




Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>