Tuesday, January 14, 2014

PowerShell error "Unable to connect to remote server"

When i was trying to send email via PowerShell to using below cmdlet, getting error
Unable to connect to the remote server”.

Send-MailMessage -to "dineshsingh@tech.com" -from "John@tech.com" -Subject " Test message" -Body " Test message" -SmtpServer " smtp.tech.com"


  • Right click on McAfee icon 
  • Click on Virus Scan Console
  • Double click on Access Protection on VirusScan Console
  • On Access Protection tab
  • Go to Anti-Virus Standard Protection
  • On right hand side, double click on Prevent mass mailing worms from sending mail
  • On process to exclude tab, add PowerShell.exe at the end
  • Click ok 
  • Click apply on Access Protection
  • Click ok

  Try again it will work smoothly.

1 comment:

  1. I experienced the same exact error; the issue was that the SMTP host I was using needed a VPN connection to be able to use the SMTP host. I was able to send emails from PowerShell while connected to the VPN but unable to send emails using the same PowerShell script when not connected to the VPN.