Tuesday, 3 April 2012

Restart a Windows Server from a Linux Server

I stumbled upon this little beauty today:
net rpc shutdown -r -W dev -U localadmin -S hostname
-W workgroup or domain
-U user that is able to switch off windows box
-S Hostname of windows box (-I can be used instead of -S to provide an IP address)

In essence this is the shutdown command in Windows that is being sent from Linux via RPC.

In order to shut the windows server down, one could use this:
net rpc shutdown  -W dev -U localadmin -S hostname

1 comment:

  1. Wow, this is good.
    To restart a box on a Windows domain from a linux host, issue this command:
    net rpc shutdown -r -U AD_ID@DOMAIN_FQDN -S HOSRNAME_OR_IP;

    net rpc shutdown -r -U administrator@mydomain.com -S