[quoted text, click to view] "Dan" <daniel_c_hate_spam@NoSpam_myrealbox.com> wrote in message
news:O7sQ6WdHFHA.2984@TK2MSFTNGP15.phx.gbl...
> "Jeff Henkels" <jeff@mapson.jeffhenkels.com> wrote in message
> news:O6kAWYcHFHA.2156@TK2MSFTNGP09.phx.gbl...
>> "Dan" <daniel_c_hate_spam@NoSpam_myrealbox.com> wrote in message
>> news:u1U5XCaHFHA.560@TK2MSFTNGP12.phx.gbl...
>>> Is there any command we can use in scheduled task to restart the IIS
>>> SMTP server automatically without restarting Websites & FTP?
>>>
>>> I check IISreset command, but no parameter to restart SMTP only.
>>
>> Go into Control Panel/Administrative Tools/Services & bring up the
>> properties for the SMTP service; the Recovery tab has options for
>> automatically restarting the SMTP service.
> Thanks. I am aware of it, but is there any specific command to do this
> manually?
No, but you could do it with a couple instances of the sc command:
sc query smtpsvc -- find out if smtp is running
sc start smtpsvc -- start it if it isn't
Combine those commands and a bit of parsing code into a batch file, and
you're there. You could also write a JScript/VBScript or a Win32 console
program in VB or VC that does the same thing.
If you're not interested in verifying that the start succeeded, you could
just periodically execute "sc start smtpsvc". If the SMTP server is already
running, the command will fail, and if SMTP's stopped, it'll restart.