I have a pfsense machine which I am trying to shutdown when the main server running Win2k8 is shutdown.
I have created a batch file with this command:
E:\plink\plink -ssh -P 22 -pw mypassword email@example.com "/sbin/shutdown -p now"
It is just one line and nothing else is required to be done. I tested the batch file (ran it by double-clicking) and it worked successfully.
I saved it as "firewallshut.bat" and associated the same with shutdown command (via GPEDIT.msc) by adding it on the "scripts" tab. It is copied to the required folder (C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown). However, when the system is shutdown, the script (batch file) doesn't work at all and on top of that it pushed the server into a waiting mode ("Waiting for Group Policy Update Client"). I waited for a long period and then had to power-off the server.
I am thinking of adding "exit" command to the file. Will that be sufficient or am I missing something else? If this doesn't work, I will have to do a hard shutdown again and hence I am reluctant to test it.