Solved

Service.msc

Posted on 2014-12-12
7
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM 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 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
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…
Suggested Courses

622 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