If you have an open CMD.exe window, your attemps to logoff or shutdown may fail with:
The Windows application, Cmd.exe cannot respond to the End Task request.
If you End Task, the CMD window may close after 10 minutes. If you Wait, you will grow old, and if you Cancel, the CMD window closes, but you are not logged off.
The can happen if you have an invalid registry entry that allows an inappropriate number of CSRSS threads to be running.
Use Regedt32 to navigate to:
If the data value ends in MaxRequestThreads, change it to end in MaxRequestThreads=16
Exit Regedt32 and shut down.