script to change Relay RestrictionsRSS

4 replies

Last post Mar 04, 2012 12:27 PM by jimrPA

  • script to change Relay Restrictions

    Nov 18, 2011 11:49 AM|jimrPA|LINK

    Hi,

     I am having a tough time on trying to figure out how to write a script or app to change the following setting

    Relay restrictions, select the radio button All except the list below

    Can this be scripted out?

    Thanks

    here is how I got to set it via vbs for anyone else who needs to do this

    Option Explicit
    Dim iisSmtpServer, relayIpList


    Set iisSmtpServer = GetObject("IIS://localhost/smtpsvc/1")
    Set relayIpList = iisSmtpServer.Get("RelayIpList")
    relayIpList.GrantByDefault = true
    iisSmtpServer.Put "RelayIpList",RelayIpList
    iisSmtpServer.SetInfo

    IIS7 Iis 6 smtp relay restrictions

  • Re: script to change Relay Restrictions

    Nov 20, 2011 11:21 AM|StormInternet|LINK

    as its more likely to be a coding issue hence I would suggest you to post it on asp.net forum so that a developer may shade some light on it quickly
  • Re: script to change Relay Restrictions

    Nov 20, 2011 08:30 PM|HCamper|LINK

    Hi,

    So you have part of the solution and  are stuck on the Form Event & Radio Buttons.

    The Vista Forums has a guide "Using Radio Buttons within Powershell"

     http://www.vistax64.com/powershell/142583-using-radio-buttons-within-powershell.html

    looks like the Radio Buttons script should work.

    When you get the project done could you update this thread with the code ?

    I do not use Buttons &  PS "just plain jane" scripts.

    Cheers :)

    Martin

     

    Windows and Linux work Together IT-Pros
    Community Member Award 2011
  • Re: script to change Relay Restrictions

    Nov 20, 2011 08:59 PM|steve schofield|LINK

    Steve Schofield
    Windows Server MVP - IIS
    http://iislogs.com/steveschofield
    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget

  • Re: script to change Relay Restrictions

    Mar 04, 2012 12:27 PM|jimrPA|LINK

    I been meaning to post the resolution to this, but forgot. Here is a vbscript to do it

    Option Explicit
    Dim iisSmtpServer, relayIpList


    ' Create an instance of the SmtpServer object that represents the default smtp server.
    Set iisSmtpServer = GetObject("IIS://localhost/smtpsvc/1")
    ' Get the current relay ip list
    Set relayIpList = iisSmtpServer.Get("RelayIpList")
    ' Set to allow all
    relayIpList.GrantByDefault = true

    ' Save the settings
    iisSmtpServer.Put "RelayIpList",RelayIpList
    iisSmtpServer.SetInfo

    http://richardprodger.wordpress.com/2011/07/18/using-the-windows-smtp-server-in-azure/ that site set me in the right direction