//Random Tip
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow

You are viewing a random entry, refresh your browser to change.

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


View Comments »



Comments 

Add your comment

Comments are currently disabled
First I had to grant privileges to the "Domain Admins"

net rpc rights grant 'JURI.LAN\Domain Admins' SeRemoteShutdownPrivilege

Then I had to use this command:

net rpc shutdown -t 10 -U admin_name%admin_password -I computer_IP -C "your comment may not be empty"

Only the combination of -C and -I did the trick. It seems that -C can not be empty
Posted 2009-06-17 12:18:23

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit