The easiest way to do a remote shutdown (or place any other command) is to have an ssh key for the root user. Here’s how to make one.
After this you can log in without password, so the task is easy:
ssh root@<ip adress or alias of the server> shutdown -h now
would shut down the remote box immidiately. Furthermore, you can actually run any command on the remote machine in the same way.