In some environments that have recently updated to Windows 11 version 24H2, shutdown and restart (when exiting) are abnormally slow, and in some cases the computer will remain stuck on the "Shutting down" or "Restarting" message unless you press and hold the power button.
This issue occurred in my environment as well, so I checked each of the PCs I own and found that the same symptoms were present on both my desktop and laptop.
This symptom was not seen in version 23H2, so I was sure there was a problem with 24H2, and after some testing I discovered the cause.
Reasons why Windows 11 version 24H2 shuts down or restarts slowly
After investigating the issue, I determined that the cause of the slow shutdown and restart times in Windows 11 version 24H2 was a network anomaly.
*What is presented here may not necessarily be the root cause.
First of all, in terms of the network, there were no problems with wired connections (Ethernet) being interrupted or unable to connect, but with a laptop connected via Wi-Fi,Task tray (notification area)There was a bug where the Wi-Fi icon would change to a globe, making it impossible to connect.
There were no problems with the internet when using a wired connection, but the slow shutdown and restart symptoms were constant, so I thought there might be some connection.
How I solved the problem
The way I solved this problem was to reset the network.
It seems that updating to Windows 11 version 24H2 caused some network-related issues, which is why it takes a long time to close network-related things when shutting down or restarting.
In my environment, I used the network reset method described on the next page, and the problem was resolved on both my desktop and laptop.
How to reset your network in Windows 10/11
If you are having trouble, please try this.

Comment: