Problem

When trying to install or uninstall SQL Server, the setup process fails with the following message:

Rule "Restart Computer" failed.
A computer restart is required. You must restart this computer before installing SQL Server.

This happens because there are pending restart operations on the machine and the setup needs a reboot before continuing. The problem is, that sometimes, even if the computer is restarted, the setup process can fail at exactly the same step.

 

Solution

Check if there are pending rename file operations that needs to be done after the computer is restarted.

To do this open a registry editor (Start -> Run -> Regedit) and navigate to the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\

 

...

 

Right click on the PendingFileRenameOperations registry key from the right pane, to see the files that will be renamed after the restart.

These entries are added to the registry when a program needs to rename a file that is being used. The file names are stored in this registry key until the system is restarted so they can be renamed.

The best approach is to rename the PendingFileRenameOperations registry key (PendingFileRenameOperations_OLD for example) and re-run the SQL Server Setup. This time, the setup will pass the "Restart Computer" rule. After the computer starts you can rename back the PendingFileRenameOperations_OLD to PendingFileRenameOperations registry key or add the containing entries to the newly created PendingFileRenameOperations key (if this is the case).

Sometimes the PendingFileRenameOperations registry key is not present in the above path. In this situation, a solution will be to avoid the pending restart by installing / uninstalling SQL from the command line. To do this go to the SQL installation folder and from the cmd prompt execute the following:

setup.exe /SkipRules=RebootRequiredCheck /ACTION=install

or

setup.exe /SkipRules=RebootRequiredCheck /ACTION=uninstall

By doing this, the setup will skip the rule that verifies if there are any restart pending operations.

 

 


No feedback yet

Leave a comment


Your email address will not be revealed on this site.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)