Microsoft Exchange Server 2016 PowerShell Cookbook - Fourth Edition
by Jonas Andersson, Nuno Mota, Mike Pfeiffer
How it works...
The script accepts one IP address as an argument, which is the IP address we will search for. We start by retrieving a list of all receive connectors across all servers using the Get-ReceiveConnector cmdlet. We then process each one individually by using ForEach's alias %, and retrieve their RemoteIPRanges properties which contains all the IPs configured for that particular connector. Using another ForEach, we go through all the entries in the RemoteIPRanges list and start by checking if their LowerBound IP is :: (IPv6) or 0.0.0.0 so we can exclude default connectors otherwise our comparison later on would always match. After all, any IP address is included in 0.0.0.0-255.255.255.255, so that is why we exclude these.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access