You may use the Microsoft Windows PowerShell script below to remotely reboot a Microsoft Windows Server 2012 R2 host.
This script will request the hostname of a remote server then forcefully restart the server.
This script will automate the process of forcefully restarting a remote server.
Written by Noel Enrique Alvarez on Monday, August 08, 2016.
#Request the hostname of the remote server
$SERVER = Read-Host “What is the hostname of the server?”
#Force the restart of the remote server
Restart-Computer $SERVER -Force
#End of script