Sometimes, Windows may encounter a situation where it gets stuck at the “Preparing Windows. Do not switch off the computer” message and fails to shut down. Despite waiting for an extended period, no progress is made.
In this article, I will provide you with a solution that can effectively resolve this problem, which is a common occurrence. By following the steps outlined, you can overcome this issue and ensure a smooth shutdown process for your Windows system.
Preparing Windows… Windows Update for hours
The following solution applies to Windows 10, Windows Server 2016, and Windows Server 2019. The message “Preparing Windows – do not turn off the computer” often occurs in connection with Windows updates.
If an operating system has not restarted for a long time and Windows updates are installed during shutdown or restart, the following problem can occur:
Windows prepares the installation of the updates, which “actually” should be installed at the next start-up process. The message “Windows is being prepared. Do not switch off the computer“ is displayed.
This process usually takes a few seconds to a few minutes. But what to do if nothing happens for more than 30 minutes or even hours? At some point, patience will run out.
The system hangs with this message when shutting down after a Windows update due to the Windows Modules Installer (trustedinstaller.exe). This service will be terminated at the end of these preparations – but unfortunately this does not always work.
Stuck Windows Updates – Terminate Trusted Installer remotely
Fortunately, Windows is still “responsive” in this state. The Microsoft Management Console (mmc.exe) can be used to establish a network connection with the relevant computer and, for example, display the services. There you can see very quickly that the Windows Modules Installer is in the status “Ending”. And therein lies the problem: The service or the associated process cannot be terminated and prevents Windows from shutting down.
In order to help out here and get Windows to leave the status “Preparing Windows…”, we need the tool PsExec from the Windows Sysinternals Tools. This command line tool allows access to remote Windows computers in the network.
Launch an administrative PowerShell console or command prompt and enter the following command:
psexec64.exe \Computername cmd
(Computer name is the name of the PC on which the above message appears)
The tool then executes the remote computer’s command prompt and displays it in your open console. That means: From now on you work on the PC, which the message “Preparing Windows – do not turn off the computer“ displays. The goal now is to use the “TrustedInstaller” process task kill to shoot, or to end.
For this we need the associated process ID (PID), which can be called up very quickly with the following command:
sc queryex trustedinstaller
It is important at this point that the status of the service (state) is in the state “3 STOP_PENDING”. Only then should you stop the service with the following command. If not, the Windows Update is still being processed. Then just wait a little longer until the status changes.
If the correct status is displayed, you can start the process with the command
taskkill /PID <id> /F end. Windows will now show the status “Windows is being prepared. Do not switch off the computer“ and shut down properly or restart. The Windows update should be installed correctly, and the Windows operating system should be available again.
Under no circumstances should you switch off the computer or server or restart it with the reset button. If the update process is still active (service status 2), you could damage the Windows installation or encounter other major problems.