Solved

Service.msc

Posted on 2014-12-12
7
149 Views
Last Modified: 2014-12-15
Services.mscI have MAPILabPOP3 Connector service running in my Services.msc on SBS2011.
This service stops running once in a while on its own and sometime when the server restarts, it does not run. So in both occasions, I have to start that service manually from time to time.

Two things I like to accomplish:
(1) Start this service as the file server restarts. Because sometimes it starts automatically and sometime it does not. So I like to give it one more push every time the file server restarts.
(2) I like to be able to check to see if it is running daily. If it is not running, I like to run my batch file "Start_MAPIPOP3.bat" which has the command "Net Start MAPILabPOP3Connector"
How can I write a script in a batch file (.bat) so that I can schedule these to run at scheduled times?
0
Comment
Question by:sglee
7 Comments
 
LVL 14

Accepted Solution

by:
Michael Dyer earned 125 total points
ID: 40497368
Why not just schedule the batch file with the Net Start command to run daily - if the service is already running it will just reply that it is already started.  No need to check anything.  Just be sure that you put this in the scheduler with administrator credentials so the scheduled event has the rights to start a service.
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 250 total points
ID: 40497381
>> (1) Start this service as the file server restarts.
Try setting the Startup Type to Automatic (Delayed ...) and see if that helps.
0
 

Author Comment

by:sglee
ID: 40497485
So if the service is already running and if I run NET START command once a day in taskschd,  it won't do any harm?

If that is the case, then I will simply schedule it to run once a day and create another one to run Auto Delayed as suggested.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 24

Assisted Solution

by:lionelmm
lionelmm earned 125 total points
ID: 40497906
The suggestion above about auto delayed is meant to change the properties of the service itself in Services, there is a choice to say either Automatic or Automatic delayed and yes if you try to start a service that is already started it won't hurt anything it will just indicate that it is already started.
0
 

Author Comment

by:sglee
ID: 40497912
$lion
Yes that is how I understood their comments.
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 250 total points
ID: 40497927
I would do "sc start <servicename>" btw, as said trying to start if it were running is OK, it just says:
C:\WINDOWS\system32>sc start wsearch
[SC] StartService FAILED 1056:

An instance of the service is already running.

Open in new window

If you want to check whether it is running:

C:\WINDOWS\system32>sc query wsearch

SERVICE_NAME: wsearch
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\WINDOWS\system32>sc query wsearch | findstr /i running
        STATE              : 4  RUNNING

Open in new window

0
 

Author Comment

by:sglee
ID: 40499008
Thanks everyone for your help.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now