How Optimize the Windows Registry Regularly Using NTREGOPT With Task Scheduler

NTREGOPT is a registry optimization tool for Windows NT/2000/2003/XP/Vista. This program compacts the registry to the minimum size possible by removing any slack space that may be left after installing or uninstalling applications in the system. Note that this program does not modify the registry contents in any way.

Registry optimization as a scheduled task

NTREGOPT can be run in silent mode using the /silent parameter, and can be run as a Scheduled Task. Here are the instructions.

Important: You should restart the system immediately because any changes made to the registry after NTREGOPT has been run are lost after the reboot. The user is supposed to close all running applications before continuing the registry optimization process. In this case, we’re going to launch NTREGOPT using a VBScript so that the user is cautioned about a system restart that’ll take place after optimization is complete.

Also, do not run NTREGOPT when updates (from Windows Update) are pending to be installed, or when a reboot is already pending.

Follow these preliminary steps first:

  • Download and install NTREGOPT if it’s not already installed.
  • Download and save to Desktop. Extract the file ntregopt.vbs (which is the launcher script) to a permanent folder. This is the file we’re going to run using Task Scheduler.

Instructions for Windows Vista

1. Open Task Scheduler from Control Panel or by running the command control schedtasks from Start, Search box.

2. In the Actions pane on the right, click Create Task…

3. Type a name for the task that you want to create (e.g. NTREGOPT), and optionally assign a description.

4. Enable the option Run with highest privileges. This is an important step.

5. Select the Triggers tab, and click New

6. In the New Trigger window, configure the settings as desired (say, Weekly), and click OK

7. Select the Action tab, and click New

8. In the Program/script: text box, mention the full path to NTREGOPT.VBS (e.g. "D:\Scripts\NTREGOPT.VBS")

Note: If the path contains spaces, include it within double quotes.

10. Click OK, OK.

You’ve now created a new task to run registry optimization once in a week. When the Task runs, you’ll see message windows as shown below.

11. At this point, save your work and close all running applications before clicking Yes.

12. Click OK to start the registry optimization task.

Instructions for Windows XP (*Service Pack 2 and higher*)

1. Open Schedule Tasks. To do so, click Start, Run and type control schedtasks

2. Double-click Add Scheduled Task

3. In the Scheduled Task Wizard dialog, click Next

4. Click Browse…

5. Locate the ntregopt.vbs file, and click OK

6. Mention a name for the task, and select Weekly and click Next

7. Select the time and day when you want this task to run, and click Next

8. In the next screen, type the administrative account name and password.

9. Select the Open advanced properties for this task when I click Finish checkbox

10. Click Finish

11. Enable the Run only if logged on option, and click OK.

Note: The registry optimization task requires administrative credentials. You have to log on to the computer by using administrative credentials for the task to run.

NTREGOPT switches – from Readme.txt

If you plan to run NTREGOPT using a shortcut, here are the command-line parameters that you would like to know. Simply running NTREGOPT.EXE without any switches, will work as well.

NTREGOPT silent [/noprogresswindow] [/reboot]

Description of the command line switches:

silentPuts NTREGOPT into "silent" mode.
/noprogresswindowHides the progress window during optimization.
/rebootAutomatically reboots the computer when optimization
of the registry is complete.

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.