Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $smtpuser = Get-SSMParameter -Name SMTP_User
  2. $smtppass = Get-SSMParameter -Name SMTP_Password -WithDecryption $true
  3. $smtpfqdn = "$env:computername.$env:userdnsdomain"
  4.  
  5. $SmtpConfig = Get-WMIObject -Namespace root/MicrosoftIISv2 -ComputerName localhost -Query "Select * From IisSmtpServerSetting"
  6. $RelayIpList = @( 24, 0, 0, 128, 32, 0, 0, 128, 60, 0, 0, 128, 68, 0, 0, 128, 1, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 127, 0, 0, 1 )
  7. $SmtpConfig.RelayIPList = $RelayIPList
  8. $SmtpConfig.AllowAnonymous = $false
  9. $SmtpConfig.AuthBasic = $true
  10. $SmtpConfig.RouteUserName = $smtpuser.Value
  11. $SmtpConfig.RoutePassword = $smtppass.Value
  12. $SmtpConfig.AlwaysUseSsl = $true
  13. $SmtpConfig.DefaultDomain = $smtpfqdn
  14. $SmtpConfig.SmartHost = "email-smtp.us-west-2.amazonaws.com"
  15.  
  16. $SmtpConfig.Put()
  17.  
  18. Restart-Service "SMTPSVC" -ErrorAction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement