Login    Forum    Search    FAQ

Board index » Upgrading and Repairing Forum » Scott's Tips




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Eliminating Windows shutdown delays
 Post Posted: Sat Apr 21, 2007 11:13 am 
Offline
Site Admin

Joined: Sun Feb 04, 2007 11:44 am
Posts: 5896
One of the biggest complaints I hear about Windows is that "It takes a long time for the system to turn off!" On some systems, the shutdown process can take several minutes or longer before the system finally powers off. Compare this to a system with a clean OS installation, where the shutdown time can normally be measured in seconds. It is unfortunately all too common for the Windows shutdown sequence on a system to grow longer and longer over the time a system is in service. This article will explain potential causes and solutions for this problem.

Shutdown delays are often blamed on Windows, when in reality they are usually caused by 3rd party software that has been installed on the system. In fact, because Windows generally shuts down very quickly after a clean install, the appearance of overly long shutdown times might be taken as an indicator that a fresh OS installation might be desirable. For example, I have a 3.2GHz P4 system on which I've recently done a clean install of Windows XP. I also installed the latest service pack, all post service pack updates, the most recent drivers for all of the hardware, as well as all of my commonly used applications (there are 32 programs listed as installed under "Add/Remove Programs"). When I shut the system down either by pressing the power button on the front of the chassis or via the Start menu, it takes only about 11 seconds before Windows shuts down and the system powers off. If your systems are taking much longer than 15 to 20 seconds to shut down, you will want to read on.

In most examples I've studied, lengthy shutdown times are caused by problems with 3rd party drivers, processes or applications that have been installed on the system. In particular, long wait times at the "Saving your settings..." or "Windows is shutting down..." screens generally indicate that a driver, service, process or application did not properly close and release resources, causing the system to wait for predefined timeout periods before eventually forcing a shutdown. Printer drivers and virus or malware/adware scanning programs are especially prone to causing this problem.

You can easily determine whether this is happening on a system by using the Event Viewer to view the Application event log to look for specific events indicating this type of problem. To do this use the following steps:

  1. Select Start; Run; type "eventvwr.msc"; click OK.
  2. Under Event Viewer (Local), select Application.
  3. Click on the Event column heading to sort the events by Event ID.
  4. Now scroll down the list to see if there are events with IDs of 1517 or 1524. If so, these are generally caused by 3rd party drivers, processes, or applications that do not stop and release resources when you log off.

To troubleshoot or identify what driver, service, process or application is causing the problem you can view more information about the Application event log entries by double-clicking on them. To potentially see even more information about the problem, you can also enable user environment debug logging and check the log that is created. The following Microsoft KnowledgeBase article explains how to do this: How to enable user environment debug logging in retail builds of Windows

Unfortunately even with these tools it is often difficult to narrow the problem down to a specific program, and even then it is unlikely you will be able to get the developer or vendor to change the code.

To help resolve this issue, Microsoft has released a special utility called the Microsoft User Profile Hive Cleanup Service (UPHClean). Once installed, UPHClean runs as a service that takes action at logoff to allow profiles to unload. UPHClean does this by monitoring the computer while Windows is unloading user profiles, then forcing any resources that remain open to close, thereby allowing the system to properly unload and reconcile user profiles. You can also choose to have UPHClean only *report* what processes it finds preventing profiles from unloading, thus allowing it to help serve as a diagnostic tool identifying the specific culprits. But the most important thing to note is that UPHClean takes care of these problems without needing to know what specific code is causing them.

To download the latest version of the UPHClean utility and documentation, visit the following Microsoft site: http://blogs.technet.com/uphclean

Microsoft also has more information about this issue in the following KnowledgeBase article: Troubleshooting profile unload issues

In addition to using the UPHClean service, another method to improve shutdown times even further is to simply reduce the default timeouts and eliminate the prompts related to drivers, processes or applications that don't properly unload. This works because Windows uses several registry values to control the timeouts for ending or killing open services, processes and applications. By decreasing these values from the default settings, you can cause Windows to force a shutdown much more quickly. These changes can be made by editing the registry manually, or automatically via a .REG file. For a manual edit, perform the following steps:

  1. Select Start; Run; type "regedit"; click OK.
  2. Navigate to "HKEY_CURRENT_USER\Control Panel\Desktop" (this key contains settings for the current user).
  3. To automatically end non-responding tasks at shutdown, right click on AutoEndTasks, select Modify, and change the value to 1 (the default is 0).
  4. To reduce the wait time prompting about non-responding applications, right click on HungAppTimeout, select Modify, and change the value to 2000 (the default is 5000 milliseconds).
  5. To reduce the wait time before killing non-responding applications, right click on WaitToKillAppTimeout, select Modify, and change the value to 2000 (the default is 20000 milliseconds).
  6. Navigate to "HKEY_USERS\.DEFAULT\Control Panel\Desktop" (this contains settings for all or new users) and repeat steps 3 through 5.
  7. Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control" (this contains settings for the system).
  8. To reduce the wait time before killing non-responding services, right click on WaitToKillServiceTimeout, select Modify, and change the value to 2000 (the default is 20000 milliseconds).

To undo these changes, merely run the same sequence of steps changing the values back to the defaults as indicated.

In order to automate these registry changes, I've compiled them into a file called FastShutdown.reg. To add the changes into the registry, merely double click on the .reg file, then click on Yes when you see the "Are you sure..." prompt. To undo these changes, double click on the companion file called FastShutdown-undo.reg, which will restore the default settings for all of the entries.

You can get the files here:
FastShutdown.reg
FastShutdown-undo.reg

In order to test the UPHClean service and the fast shutdown registry changes, I found a system that was taking an exceptionally long time to shut down. After pressing the power button (or clicking on Start; Turn Off Computer...; Turn Off), the shutdown would proceed as follows:

    Closing network connections... (2 seconds)
    Saving your settings... (1 minute 20 seconds)
    Windows is shutting down... (30 seconds)

The total time to shutdown was about 1 minute 52 seconds. I then installed the UPHClean service and retested. The time to shutdown then proceeded as follows:

    Closing network connections... (2 seconds)
    Saving your settings... (1 second)
    Windows is shutting down... (30 seconds)

Using the UPHClean service alone, the total time to shutdown had been reduced to about 33 seconds, a major improvement. I then installed the fast shutdown registry settings and retested. The time to shutdown then proceeded as follows:

    Closing network connections... (2 seconds)
    Saving your settings... (1 second)
    Windows is shutting down... (13 seconds)

Using both UPHClean and the fast shutdown registry settings, the total time to shutdown had been further reduced to about 16 seconds, another major improvement.

Upon investigating the system more closely, it seemed that certain antivirus and malware scanning tools were largely responsible for the lengthy 1:20 time spent "Saving your settings..." on this system, an issue which UPHClean was able to solve without having to uninstall them. Further changing of registry settings to reduce timeouts and eliminate potential prompts cut the shutdown time even further.

In conclusion, lengthy Windows shutdown times seem to be mostly caused by or related to 3rd party drivers, processes, services and applications (especially anti-malware apps) that have been installed on a system after the intitial Windows installation. Often times I use the appearance of lengthy shutdowns to indicate the need for a clean installation of Windows, however I have also discovered other techniques for improving shutdown times without undertaking a clean installation.

I recommend the installation of the UPHClean service as well as changing the registry entries for a fast shutdown as I have indicated. Combining these two procedures can often dramatically reduce the time Windows takes to shutdown.

If you apply this information, please let me know via if it helps reduce your shutdown times. It would be especially interesting to know the "before" and "after" results of applying both UPHClean and the fast shutdown registry entries separately. Thanks, Scott.


Top 
 Profile  
Reply with quote  
 Post subject: Re: Eliminating Windows shutdown delays
 Post Posted: Sun Sep 05, 2010 10:27 am 
Offline

Joined: Thu Apr 09, 2009 10:17 am
Posts: 32
Location: Michigan
I followed the link to UPHClean. The last post 'Wed, Jan 6 2010' indicates that UPHClean is now officially dormant.

http://blogs.technet.com/b/uphclean/


Top 
 Profile  
Reply with quote  
 Post subject: Re: Eliminating Windows shutdown delays
 Post Posted: Sun Sep 05, 2010 11:30 am 
Offline
Site Admin

Joined: Sun Feb 04, 2007 11:44 am
Posts: 5896
It may be "dormant", but it is still both available and just as useful under Windows NT/2000/XP/2003 as I describe above. In fact I've been automatically including it in all of my Windows XP loads for many years now, with only positive results. Note that a similar service is already included in 7/Vista, making UPHClean redundant for those OS.

You can download the final 2.0.49.0 beta release here, and the latest non-beta version (1.6g released Sept. 14, 2010) here. I use (and recommend) the non-beta version. Scott.


Top 
 Profile  
Reply with quote  
 Post subject: Re: Eliminating Windows shutdown delays
 Post Posted: Tue Sep 14, 2010 10:14 am 
Offline

Joined: Thu Sep 04, 2008 7:30 pm
Posts: 80
Excellent post Scott. Thank you so much.


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 4 posts ] 

Board index » Upgrading and Repairing Forum » Scott's Tips


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron