Not the service but the SMTP Virtual Server in IIS.
Main Topics
Browse All TopicsHow can I write a script to start the SMTP Virtual Server in IIS when it's stopped? I'm not very good at scripting but can anyone point me in the right direction on how to write a script to do this. I can find ways to restart IIS or to start IIS but that's not what I need. I need the ability to just start the SMTP Virtual Server running in IIS.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
use adsutil script in c:\inetpub\adminscripts:
stop virtual server:
adsutil set SMTPSVC/<nn>/ServerState 4
start virtual server
adsutil set SMTPSVC/<nn>/ServerState 2
where <nn> is the virtual server id (default is 1)
you can find out the server id by opening smtp server properties, enable logging, click properties button (next to logging) and observer the value at the bottom of that pane for "log file NAME" will be something like "SmtpSvc<nn>\exyymmdd.log"
Cheers.
Thanks Mike I believe this is what I'm looking for but can also give me the idiot award because I don't know what to do with the info you provided. Yes the SMTP id is the default of 1 which I checked. I need to write a script that my monitoring software will launch whenever this Virtual Server is stopped for any reason to restart the Virtual Server. Since I'm an idiot can you be more detailed almost as if you're helping your grandma with this?
Ok,
so what monitoring software are you using?
if you want to simply make sure that the server is running, just use windows task scheduler.
enter "c:\inetpub\adminscripts\a
when the script runs, the smtp server state will be set to 'running' regardless of what state it was in at the time. If it was already running, then there will be simply no change - i.e. it does not cause an error or service interruption of any kind.
Cheers.
Business Accounts
Answer for Membership
by: nightmare2Posted on 2008-03-17 at 13:11:44ID: 21145666
Use the command 'net start smtpsvc' in a batch file