For at least a decade, Windows has been blocking the ability to shut down the operating system when connected to the user interface remotely, using Terminal Services, aka, Remote Desktop Connection.
Since 2002, I’ve been using a very simple executable program (that requires no installation) to shut down a computer that I’m remotely controlling.
Even this latest 188.8.131.52 version from 2003 supports any version of Windows (server and desktop flavors, right through Windows 7). Handy Wake-On-LAN and remote PC actions as well.
Excellent online documentation here: