Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2016 / Fix: Windows Stuck at “Preparing to Configure Windows”

August 23, 2021 Windows 10Windows Server 2012 R2Windows Server 2016

Fix: Windows Stuck at “Preparing to Configure Windows”

It is not the first time when I have encountered the following issue on Windows Server 2016 (2012 R2 or 2008 R2): after the installation of updates or some roles/features, a server prompts to be restarted. Then the message “Preparing to configure Windows. Do not turn off your computer” appears and the server gets stuck for hours. However, the server is accessible over the network, but a number of services, including RDP, are unavailable.

The first tip when such a problem appears is to do nothing. Just try to wait until the updates are installed. The Windows component update process can take a long time, especially on older slow devices, or if you haven’t installed Windows updates for a long time. If the installation of updates takes more than 2 hours, this is no longer normal and you can try to solve the problem according to this article.

computer stuck preparing to configure windows, Do not turn off your computer

If there is no time to wait, you can try to quickly solve the problem of simply restarting the server/computer using a hard reset. You can reset the physical server from the HP ILO console, Dell iDRAC (etc.), or from the Hyper-V/vSphere console, for virtual machines. However, this can negatively affect Windows or your applications. It is better to use a more “soft” way to reset the host that is stuck during the update installation phase on reboot.

To fix the issue, you will need another Windows computer (or server) located on the same network as the problem host. Run the Services mmc snap-in (services.msc) on it and remotely connect to the stuck server (Action -> Connect to another computer -> specify the name or IP address of the problem server).

connect to services on remote windows device

In the list of services of the remote server, it is easy to find Windows Modules Installer in the Stopping state. Obviously, this service is preventing Windows from performing a correct reboot.

Windows Modules Installer service in stopping state

On Windows 10, this issue can be encountered when the following text appears on reboot “Shutting down service: Windows Modules Installer”.

You cannot end or pause the TrustedInstaller service, because the service control buttons are inactive. In the properties of the service, you can find the name of the executable: C:\Windows\servicing\TrustedInstaller.exe

C:\Windows\servicing\TrustedInstaller.exe stuck on stopping

Our task is to force this process to stop. The easiest way to use the way described in the article How to Kill a Windows Service which is stuck at stopping? bearing in mind that you will have to do all steps remotely.

Open the command prompt on any computer on the same network, and run the following command against the server lon-man02 to stop the TrustedInstaller.exe process:

taskkill.exe /s lon-man01 /u corp\maxbak_adm /p Pa$$w0rdd! /im TrustedInstaller.exe

In this example, I specified an administrator account name (corp\maxbak_adm) and password (Pa$$w0rdd!) to connect to the remote computer.

You can also kill the process remotely using the Pskill utility from the PSTools toolkit:

pskill.exe \\lon-man01 TrustedInstaller.exe

Or PsExec:

psexec \\lon-man01 taskkill /IM TrustedInstaller.exe /F

After that, the message Shutting down will appear on the screen of the stuck server, and in some moments it should reboot correctly.

correctly- shutting down windows

Windows can stuck on preparing for configuring phase when installing components or updates due to Windows Modules Installer service issues not only on Windows Server but also on desktop version (Windows 10 and Windows 8.1).

If you are faced with the message “Preparing to configure Windows. Do not turn off your computer” every time you restart or shut down your computer, you need to clear the Windows Update Service cache and run integrity checks on the Windows image.

To clear all updates in the local Windows Update cache, follow these steps.:

  1. Stop the wuaserv and bits services:
    net stop bits
    net stop wuauserv
    net stop appidsvc
    net stop cryptsv
    c
  2. Rename the folders SoftwareDistribution and catroot2:
    Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
    Ren %systemroot%\system32\catroot2 catroot2.bak
  3. Start Windows update services:
    net start bits
    net start wuauserv
    net start appidsvc
    net start cryptsvc
  4. After restarting the wuauserv service will recreate the SoftwareDistribution and catroot2 directories and start checking and downloading updates.
You can also use the ready-made ResetWUEng script to reset Windows Update components. For details, check the article at the link.

Check the integrity of your Windows image and fix the errors found using DISM and SFC:

DISM.exe /Online /Cleanup-Image /Restorehealth

sfc /scannow

If Windows won’t boot after installing updates, you can uninstall the latest updates using the installation image or through the Windows Recovery Environment.

11 comments
3
Facebook Twitter Google + Pinterest
previous post
Hyper-V: Configuring Automatic Startup and Boot Order of VMs
next post
How to Increase Attachment Size Limit in Outlook?

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Installing Language Pack in Windows 10/11 with PowerShell

September 15, 2023

How to View and Change BIOS (UEFI) Settings...

September 13, 2023

11 comments

Matteo April 22, 2019 - 2:47 pm

Thanks, this was helpful!

Reply
Aym May 2, 2019 - 9:01 pm

Thanks alot. You saved my a**. I almost exceeded the requested downtime.

Reply
Mohammad June 10, 2019 - 2:03 pm

Million tanx for the solution , it was so helpful.

Reply
Dan Rave June 16, 2019 - 11:25 pm

Hi Sir,
Good Morning. In my case, it is only stuck but not accesible like yours.
Any advise please? thank you so much in advance

Reply
Junior October 6, 2019 - 1:34 pm

Thanks a lot. Works fine!

Reply
kevin October 15, 2019 - 6:39 pm

Mine was just a stuck GUI. Hit Ctrl-Alt-Del and the logon screen was displayed.

Reply
Sushant November 14, 2019 - 3:03 am

Thanks for help my pc stuck at this for an hour

Reply
AAA November 21, 2019 - 9:19 pm

Wow, you totally save my A**.
Thank you so much
AA

Reply
RTY February 27, 2020 - 5:25 pm

Amazing! Whoa, who knew? Thanks so much!

Reply
Dave May 22, 2020 - 4:41 pm

Thanks, worked very well for me!

Reply
Don November 3, 2020 - 2:37 am

Perfect – thank you

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Repair EFI/GPT Bootloader on Windows 10 or 11
  • How to Restore Deleted EFI System Partition in Windows
  • Network Computers are not Showing Up in Windows 10/11
  • Updating List of Trusted Root Certificates in Windows
  • How to Create a Wi-Fi Hotspot on your Windows PC
  • How to Sign an Unsigned Device Driver in Windows
  • How to Download APPX File from Microsoft Store for Offline Installation?
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top