Solved

Stop Windows Service Before Shutdown Automatically

Posted on 2014-02-18
4
2,755 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
  • 3
4 Comments
 
LVL 90

Expert Comment

by:John Hurst
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 90

Accepted Solution

by:
John Hurst 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 90

Expert Comment

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
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.

759 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

19 Experts available now in Live!

Get 1:1 Help Now