Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Service.msc

Posted on 2014-12-12
7
Medium Priority
?
174 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 500 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 1000 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 500 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 1000 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

715 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