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.
A free shutdown utility
Created by Jorgen Bosman
Made in Belgium
Even this latest 126.96.36.199 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: