How to Configure SMTP Server Auto-Start in IIS on Windows Server 2008 R2


1 views

When deploying an IIS SMTP server on Windows Server 2008 R2, administrators often face the inconvenience of manual service startup after system reboots. This creates operational inefficiencies and potential mail delivery delays.

The SMTP service in Windows Server 2008 R2 runs as a standard Windows service. By default, its startup type is set to "Manual," which explains the behavior you're observing. Here's how to verify this:

sc qc SMTPSVC
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: SMTPSVC
        TYPE               : 20 WIN32_SHARE_PROCESS 
        START_TYPE         : 3   DEMAND_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : C:\Windows\system32\svchost.exe -k iissvcs
        LOAD_ORDER_GROUP   : 
        TAG                : 0
        DISPLAY_NAME       : Simple Mail Transfer Protocol (SMTP)
        DEPENDENCIES       : IISADMIN
        SERVICE_START_NAME : LocalSystem

You can change the startup type using either the GUI or command line:

Method 1: Using Services Console

  1. Open Services.msc
  2. Locate "Simple Mail Transfer Protocol (SMTP)"
  3. Right-click → Properties
  4. Set "Startup type" to "Automatic"
  5. Click OK

Method 2: Command Line Approach

For automation or remote management, use this PowerShell command:

Set-Service SMTPSVC -StartupType Automatic

Or the traditional sc command:

sc config SMTPSVC start= auto

After making changes, verify the configuration:

Get-Service SMTPSVC | Select Name,StartType

Expected output:

Name    StartType
----    ---------
SMTPSVC Automatic

If you're managing multiple servers, consider these approaches:

Group Policy: For domain environments, create a GPO to configure the service startup type across all SMTP servers.

Dependency Handling: The SMTP service depends on IIS Admin Service. Ensure proper startup order:

sc config SMTPSVC depend= IISADMIN

If the service fails to start automatically:

  • Check the Event Viewer for related errors
  • Verify sufficient privileges for the service account
  • Ensure port 25 isn't blocked by firewall
  • Confirm IIS Admin Service starts successfully

For more control, you could create a scheduled task that runs at startup:

$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument 'Start-Service SMTPSVC'
$trigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName "Start SMTP Service" -Action $action -Trigger $trigger -User "SYSTEM"

When running an SMTP server on IIS in Windows Server 2008 R2 (or similar versions), you might notice the service doesn't automatically start after system reboots. This creates unnecessary manual intervention and potential service disruptions.

First, verify your SMTP service configuration:

sc query SMTPSVC

This will show you the current state and startup type of the SMTP service.

The most straightforward solution is to change the service startup type:

sc config SMTPSVC start= auto

Alternatively, you can use PowerShell:

Set-Service SMTPSVC -StartupType Automatic

After making changes, confirm they took effect:

sc qc SMTPSVC

Look for "START_TYPE" in the output - it should now show "AUTO_START".

If for some reason the service won't stay automatic, you can create a scheduled task:

schtasks /create /tn "Start SMTP Service" /tr "net start SMTPSVC" /sc onstart /ru SYSTEM

If the service still won't start automatically:

  • Check event logs for SMTP-related errors
  • Verify dependencies are met (IIS Admin service should be running)
  • Ensure proper permissions on the mailroot directory

On newer systems like 2016/2019/2022, consider using PowerShell DSC for more robust configuration:

Configuration SMTPAutoStart {
    Node localhost {
        Service SMTPSVC {
            Name = "SMTPSVC"
            StartupType = "Automatic"
            State = "Running"
        }
    }
}
SMTPAutoStart
Start-DscConfiguration -Path .\SMTPAutoStart -Wait -Verbose