Remotely shutdown/restart Windows via Linux on Debian/Ubuntu based Linux

Need samba-common package
sudo apt-get install samba-common

Then use this command to shutdown the computer remotely:
net rpc shutdown --ipaddress ip --user username%password

Add -r if you want to restart, not shutdown:
net rpc shutdown -r --ipaddress ip --user username%password

Success message:

Shutdown of remote machine succeeded

These messages mean failed:

  • Could not connect to server
  • Connection failed: NT_STATUS_IO_TIMEOUT
  • Could not initialise pipe winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND

There are many functions provide by net [rpc], like:

net rpc audit Modify global audit settings
net rpc info Show basic info about a domain
net rpc join Join a domain
net rpc oldjoin Join a domain created in server manager
net rpc testjoin Test that a join is valid
net rpc user List/modify users
net rpc password Change a user password
net rpc group List/modify groups
net rpc share List/modify shares
net rpc file List open files
net rpc printer List/modify printers
net rpc changetrustpw Change trust account password
net rpc trustdom Modify domain trusts
net rpc abortshutdown Abort a remote shutdown
net rpc shutdown Shutdown a remote server
net rpc samdump Dump SAM data of remote NT PDC
net rpc vampire Sync a remote NT PDC’s data into local passdb
net rpc getsid Fetch the domain sid into local secrets.tdb
net rpc rights Manage privileges assigned to SID
net rpc service Start/stop/query remote services
net rpc registry Manage registry hives
net rpc shell Open interactive shell on remote server
net rpc trust Manage trusts
net rpc conf Configure a remote samba server

Check man rpc for more detail!