Saturday, August 19, 2017

How to use Power-Shell to Perform SMTP Relay Test


In most cases, when application owner claiming, e-mails aren’t relayed through the existing internal application relay front end, you will need to perform few basic troubleshooting steps. Bear in mind asking basic questions up front will make your job easier.


What is the IP address of your application?
What platform your application is running from? (In this scenario we will assume the application is installed
on Windows Serer.

What is the host name ( FQDN) or IP address your application is configured to relay through
Do you have any logs on your application showing SMTP handshake (you are asking TCP/IP handshake).
Most   cases you won’t get this detailed information

If telnet service is installed you can sent e-mail from command line and observe the response. If SMTP relay
Front end accepting e-mails, you will need to figure it out what is happening on the transport and delivery
layers.

Here is simple PS code can be used to simplify the test from Application Server. You will need to change few variables to make this cod work in your environment

$smtpServer = "relay.smtp25.org"
$smtpFrom   = "smtp_relay@.smtp25.org "
$smtpTo     = "casey.dedeal@.smtp25.org "


clear-host

#()Variables
$subject    = "Testing SMTP Relay"
$body       = "smtp relay testing"
$smtpServer = "relay.smtp25.org"
$smtpFrom   = "smtp_relay@.smtp25.org "
$smtpTo     = "casey.dedeal@.smtp25.org "

#()Message
$Computer = $env:computername
$message  = " sent from "

#()Subject body
$messageSubject = $subject
$messageBody = $body + $message + $Computer

#()Sending
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)




Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)

Saturday, August 12, 2017


PowerShell Check if Server is alive

Use the script below to check if a server is alive # replace the server name to make it fit into your needs.

$server = “dc1.smtp25.org”

If (Test-Connection $server -count 1 -quiet) {
  Write-host  “The $server responded” -f yellow
}
else{

Write-host  “No connection to $server -f red
  Write-host “Script will stop” -f red
   Break
}



Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)


Thursday, August 10, 2017




Using PowerShell Test-Connection


#(1)_.Check if  Machine is responding

Clear-host
Write-host $null
#(a)_Capture Server name
$server = Read-host “_Provide Server Name to Test”

#(b)_. Test Connection
If (Test-Connection $server -count 1 -quiet) {
  Write-host "The $server responded" -f yellow
}
else{

Write-host  "No connection to $server" -f red
  Write-host "Script will stop" -f red
   Break;
}



Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)


Wednesday, August 9, 2017

Connect Remote Exchange Server Function



You can use below function to make connection to remote PS in Exchange 2016.
You will need to change following string $server ="EXC01.smtp25.org" to make it work for you environment.


# Connect Remote PS Exchange 2016 Server, Specify Server to connect.

# Change the server FQDN with server name you desire.
Function Connect_E16 {
    param(
        [Parameter( Mandatory=$false)]
        [string]$server ="EXC01.smtp25.org"
)
        $session = New-PSSession -ConfigurationName Microsoft.Exchange `
        -ConnectionUri http://$srv/PowerShell/ `
        -Authentication Kerberos
         Import-PSSession $session -AllowClobber
}

Clear-host
write-host $null
Write-host "_Connecting Exchange 2016 Servers"
$Connect_E16

Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)