Windows is being prepared. Do not switch off the computer.
The message is of course annoying if you have to wait 30 minutes or even hours.
The problem is usually related to Windows updates. The TrustedInstaller service cannot be stopped properly.
The problem can be solved quickly using the command line and the winrs command.
Start the CMD with administrative rights and open a connection to the remote server or workstation using WINRS.
Check the target with HOSTNAME and find out the PID for the TrustedInstaller process and end it with taskkill. The computer will now restart or shutdown cleanly. The message “Windows is being prepared” or “Getting Windows ready” follows briefly, but this should not take longer than 1-2 minutes.
winrs -r: wp0022-mail cmd.exe
sc queryex trusted installer
taskkill / PID 5328 / F
Martin F. also mentioned the OneLiner as an alternative, which saves us having to ask for the PID.
taskkill / im Trustedinstaller.exe / s <server name> / f