There may be more setup to do, especially for Windows Vista, Windows 7 and further windows versions, to allow remote shutdown:
Part A) On the Windows machine:
1) Add a remote shutdown security policy:
run
secpol.mscin the program tree, open
Security Settings>Local Policies>User rights AssignmentFind the entry
Force shutdown from a remote systemEdit the entry, add the windows user account that will be used for shutdown (ex: nouknouk)
2) Add registry keys to disable UAC remote restrictions:
Run
regedit.exeas AdministratorFind
HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/SystemCreate a new registry
DWORD(32)value namedLocalAccountTokenFilterPolicyand then assign it the value1
3) Start remote registry service:
Open
cmd.exeas AdministratorExecute the two following commands:
sc config RemoteRegistry start= autosc start RemoteRegistry
Part B) On the Linux machine:
1) install the package samba-common:
It depends on your Linux distribution, but for Debian and derivated (Ubuntu, Linux Mint, ...), the apt-get command can be executed like that:
apt-get install samba-common
2) To actually shutdown your Windows machine from the Linux one, run the following command:
net rpc shutdown -f -t 0 -C 'message' -U userName%password -I xxx.yyy.zzz.ttt
Where:
-fmeans force shutting down all applications (may be mandatory)-t 0is the delay before doing it (0 means 'right now').-U user%passwordis the local user and his password on the windows machine (the one that has been allowed to do remote shutdown in part A).-Iis the IP address of the windows machine to shutdown.