Solved

SMTP Connection/Relay List

Posted on 2014-07-28
12
1,532 Views
Last Modified: 2014-07-29
Greetings,

How to export the smtp Connection/Relay list on win server 2008 R2?
Thanks.
0
Comment
Question by:mrong
  • 7
  • 5
12 Comments
 
LVL 5

Expert Comment

by:amac81
ID: 40224899
0
 

Author Comment

by:mrong
ID: 40225012
Please provide step-by-step instructions other than a link.
Thanks.
0
 
LVL 5

Expert Comment

by:amac81
ID: 40225059
Seriously?

Get-ReceiveConnector “name of your connector here”| select -ExpandProperty remoteipranges|export-csv c:\RelayIPs.csv
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:mrong
ID: 40225108
Yes, I never ran command on powershell.

So just type the commands you provided in windows PowerShell blue window like the followings?
What should I replace with “name of your connector here"?

PS C:\> Get-ReceiveConnector “name of your connector here”| select -ExpandProperty remoteipranges|export-csv c:\RelayIPs.csv

Thanks.
0
 
LVL 5

Expert Comment

by:amac81
ID: 40225127
What version of Exchange?

You need to type in the name of the connector that you want to enumerate.
0
 

Author Comment

by:mrong
ID: 40225134
Attached is what I goterror
0
 

Author Comment

by:mrong
ID: 40225135
I don't have exchange server. only using IIS 6.0 for mail relay. thx
0
 
LVL 5

Expert Comment

by:amac81
ID: 40225139
What version of Exchange?  Also are you running this from the Exchange shell?
0
 

Author Comment

by:mrong
ID: 40225147
I ran it from PowerShell. How to check the version of Exchange?
0
 

Author Comment

by:mrong
ID: 40225168
I don't think I have exchange server setup.
0
 
LVL 5

Accepted Solution

by:
amac81 earned 500 total points
ID: 40225207
Gotcha, I didn't see that there was no Exchange.  I just assumed based on the initial post.  My apologies.

I found the below here:  http://www.classictriple.com/iis-export-iis-smtp-relayiplist/

Look at the comments as there are some things you have to change in the code to make it work in your environment.


'#####================================================================================ 
'## Title: ExportRelayIP.vbs
'##     
'## Purpose: 
'##     1. Exports List of IIS 6 SMTP Relay Restriction IP Addresses.
'## References: 
'##     1. http://msdn.microsoft.com/en-us/library/ms525725.aspx, http://msdn.microsoft.com/en-us/library/ms525320.aspx
'##     2. http://msdn.microsoft.com/en-us/library/ms524304.aspx, http://msdn.microsoft.com/en-us/library/ms525808(v=vs.90).aspx
'##     3. http://blogs.msdn.com/b/vijaysk/archive/2009/05/07/setting-smtp-relayiplist-from-a-script.aspx
'#  
'#####================================================================================
 
Set objSMTP = GetObject("IIS://localhost/smtpsvc/1") 'Connect to the IIS Namespace, You can change the "smtpsvc/1" to fit your needs.
Set objRelayIpList = objSMTP.Get("RelayIpList") 'Get the RelayIPListObject
 
' GrantByDefault returns 0 when "only the list below" is set (false) and -1 when all except the list below is set(true)
Wscript.echo "Results will be display based on the Relay Restrictions Radio Buttion Selection"
Wscript.echo "  o Only the list below"
Wscript.echo "  o All Except the list below"
Wscript.echo "-------------"
If objRelayIpList.GrantByDefault = true Then
    Wscript.Echo "All except the list below :"
    Wscript.echo "-------------"
    objCurrentList = objRelayIpList.IPDeny
Else
    Wscript.Echo "Only the list below :"
    Wscript.echo "-------------"
    objCurrentList = objRelayIpList.IPGrant
End If
    count = 0
For Each objIP in objCurrentList
    Wscript.Echo objIP
    count = count + 1
Next
If count = 0 Then
    Wscript.Echo "There were no IP Addresses Found"
End If

Open in new window


Just pipe this to a CSV.
0
 

Author Comment

by:mrong
ID: 40226375
How to pipe this to a CSV file? thx
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question