How to start SMTP virtualhost [SMTP Virtual Server #1] through powershell or command prompt

Solution 1:

To Start:

$SMTP=[adsi]"IIS://localhost/SMTPSVC/1"
$SMTP.ServerState = 2
$SMTP.SetInfo()

To Stop:

$SMTP=[adsi]"IIS://localhost/SMTPSVC/1"
$SMTP.ServerState = 4
$SMTP.SetInfo()

Solution 2:

Actual working answer is here:

([ADSI]'IIS://LOCALHOST/SMTPSVC/1').Start()
([ADSI]'IIS://LOCALHOST/SMTPSVC/1').Stop()

From: https://stackoverflow.com/a/37432396/3321505