How to enable SMTP server in Windows Server 2012

6,524

Ok, checking, adding and removing Windows components like this from the command line can be done via the powershell commands get-WindowsFeature, install-WindowsFeature, and to remove the feature afterwards remove-WindowsFeature.

To see if SMTP server is installed already use

get-WindowsFeature smtp-server

To install it use

install-WindowsFeature smtp-server

If you want a bit of re-usable code you can use everywhere to check if the SMTP server is already installed, and if not then install it then something like this ought to do it

smtp = get-WindowsFeature smtp-server
 if (!smtp.Installed) {
  $smtp | add-WindowsFeature
  }
Share:
6,524

Related videos on Youtube

Pradeep
Author by

Pradeep

Updated on September 18, 2022

Comments

  • Pradeep
    Pradeep over 1 year

    We are using servermanager.exe to install smtp server in windows 2008R2 from comand prompt. Is there any alternate to servermanager.exe? How to enable smtp server in windows 2012 from command prompt?

    Thanks in Advance.