Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $smtpuser = Get-SSMParameter -Name SMTP_User
- $smtppass = Get-SSMParameter -Name SMTP_Password -WithDecryption $true
- $smtpfqdn = "$env:computername.$env:userdnsdomain"
- $SmtpConfig = Get-WMIObject -Namespace root/MicrosoftIISv2 -ComputerName localhost -Query "Select * From IisSmtpServerSetting"
- $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 )
- $SmtpConfig.RelayIPList = $RelayIPList
- $SmtpConfig.AllowAnonymous = $false
- $SmtpConfig.AuthBasic = $true
- $SmtpConfig.RouteUserName = $smtpuser.Value
- $SmtpConfig.RoutePassword = $smtppass.Value
- $SmtpConfig.AlwaysUseSsl = $true
- $SmtpConfig.DefaultDomain = $smtpfqdn
- $SmtpConfig.SmartHost = "email-smtp.us-west-2.amazonaws.com"
- $SmtpConfig.Put()
- Restart-Service "SMTPSVC" -ErrorAction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement