Tip #839 Shutdown a windows PC from linux
A remote Windows PC can easily be shutdown, assuming you have Samba installed on your Linux box, and you have a user account on the Windows PC that has the necessary rights.Just enter the following command, where 'thehostname' is the hostname of the remote PC, and 'theusername' is a valid user account on the remote PC:
net rpc shutdown -S thehostname -U theusername
If the hostname is not known, or cannot be resolved, then use the following instead, replacing '111.111.111.111' with the IP address of the remote PC:
net rpc shutdown -I 111.111.111.111 -U theusername
Additionally, the parameters that can be used with Windows' own shutdown command such as '-f' to force or '-t' to set a timeout, can also be applied to the net rpc shutdown command as well. For example the following will wait 60 seconds, and then force all running programs to terminate before shutting down:
net rpc shutdown -S thehostname -U theusername -f -t 60
- TAGS:
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs