Using Powershell to Start-Stop the SMTP Virtual Server

One of the most popular posts on this blog has been the blog on setting up an Internal SMTP Service for SMBs that need to send server reports and support emailing from Internal devices that have move to cloud based email services.

One of the issues with this service is that is occasionally stops. There does not appear to be any reason why it stops, but it does. Restarting the SMTPSVS service does not restart the service, because it is based on IIS6.

Good news! You can use powershell to script the restart of this service.

Open an Administrative PowerShell window.

To Start the SMTP Virtual Server, type the following:

$SMTP.ServerState = 2

To Stop the SMTP Virtual Server, type the following:

$SMTP.ServerState = 4

4 thoughts on “Using Powershell to Start-Stop the SMTP Virtual Server”

  1. I don’t believe this actually starts or stops the service. I think it simply changes the display state of the icon.

    If I run this, it will add or remove the X over the Virtual Server. However, the application which uses said server will not send mail when expected. At that point I open IIS and stop it using the GUI, which throws an error, then start it using the GUI, and the app is able to send mail.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve the Equation to continue * Time limit is exhausted. Please reload CAPTCHA.