Solved

Stop Windows Service Before Shutdown Automatically

Posted on 2014-02-18
4
3,754 Views
Last Modified: 2014-02-24
We have a data intensive program that if you do not stop before shutting down, it will require a build of the cache before running again. Even worse is the program will not do any other operations before the data is rebuilt. On large systems this can take days.

The software developers claim their is no way to stop the service properly when a user calls the shutdown command since newer versions of Windows just kills everything.

I just have a hard time accepting the answer there is nothing we can do. "Just stop the service first."

I just Google'd this before I submitted this question and I found this link:
http://www.dba-oracle.com/windows_add_oracle_shutdown_script.htm

Would this work for both Windows 7/8 & 2008/2012?
0
Comment
Question by:bselltiz
[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
  • 3
4 Comments
 
LVL 96

Expert Comment

by:Experienced Member
ID: 39868308
You could invoke a batch file to shut down.

NET STOP SERVICE
(Pause if you wish0
SHUTDOWN /s

That should work.
0
 

Author Comment

by:bselltiz
ID: 39868352
Right, I thought about this as well, but the solution must not deter people from normal Windows operation. Unless someone was told specifically to use that batch file to shutdown they wouldn't. Then what happens when they forget, which is why I'm here now. So the problem would still persist.

As long as the above link works on 7/8 & 2008/2012 I think that might be solution, unless someone has a better way to do this.

Thank you for the reply.
0
 
LVL 96

Accepted Solution

by:
Experienced Member earned 500 total points
ID: 39868378
You should be able to add a script to the Windows shutdown area. You need to run gpedit.msc to enable the script. Then put a batch file in the logoff script area:

C:\Windows\System32\GroupPolicy\User\Scripts\Logoff

That script will run at shutdown (and also at logoff) and can stop the service.

You can put a script to start the service at logon.
0
 
LVL 96

Expert Comment

by:Experienced Member
ID: 39882697
@bselltiz - Thank you and I was happy to help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

623 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