Solved

Service.msc

Posted on 2014-12-12
7
158 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 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Does Powershell have you tied up in knots?

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

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
OfficeMate Freezes on login or does not load after login credentials are input.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 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