Saturday, October 3, 2009

Remote powerdown from Windows with plink.exe

Because I am using a private network without connection to the outside world,
I am not concerned about security.
Usink plink.exe as part of the puTTY package I managed a remote shutdown:
Create a shortcut on windows with the following command:
(I use the user admin for logon)

plink.exe -ssh admin@hostname -pw password -m shutdown

The tricky bit is the remote command with the option -m,
(you have to use the full path because no profile is loaded)
so my "shutdown" saved on the windows box contains this line:

/usr/bin/pfexec /usr/sbin/init 5

very similar to the 'pfexec init 5' you use when logged on in Solaris