I have a system comprised of, let's say 10 Windows 7 Professional workstations, joined to a domain.

As part of an "emergency" system shutdown procedure, I'd like a mechanism of triggering a remote shutdown, from a Linux controller (which is in turn, a service orchestration tool). The word "emergency" is in quotes because it's not really an emergency, but still need a mechanism other than simply telling the users to turn the workstations off.

So, I've looked at psexec, which is almost ideal, except only seems triggerable from another windows machine. .. I suppose it's not impossible to have a windows server trigger the workstation shutdown procedure, but that's not ideal.

I gather one option is to install Cygwin, and OpenSSH, but frankly, that seems bulky.

What I'd like, ideally.. Is a program that runs as a service, with local (or domain) Administrator privileges, listening on a port, for a SSL-encrypted, RESTful API call like, http://workstation:8888/admin/shutdown?key=secretsharedkey.

Do I need to write something in C#.net, or is there a tool out there for cross-platform triggering of a shutdown of a windows workstation?


How about using the net tool from the Samba package?

For instance:

net rpc shutdown -S workstation1 -U Administrator -w example.com

You may need slightly different command line options such as -k to authenticate with Kerberos; check the man page.

  • Ugh. Samba. I'd rather not if I can help it. I'll see tomorrow, but. Ugh. Samba. – Tom O'Connor Sep 17 '13 at 21:57
  • Works like a charm. Cheers! – Tom O'Connor Sep 18 '13 at 13:27

You can use winexe. It uses a RPC call to install a service on the target computer, and then uses this service to execute commands on it. You can specify the credentials, and the Linux server doesn't have to be a member of the domain.

Beware that it is based on the Samba code though ;)


RPC is the way, but there is may be more setup to do, especially for Windows Vista, Windows 7 and further windows versions, to allow remote shutdown:

A) Part of setup to do on Win7 machine:

1) run "secpol.msc"

  • in the program tree, open "Security Settings / Local Policies / User rights Assignment"

  • Find the entry “Force shutdown from a remote system”

  • Edit the entry, add the CONCRETE user that will be used for shutdown (ex: nouknouk)

2) Run regedit.exe as Administrator

  • find HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System

  • create a new registry DWORD(32) value named "LocalAccountTokenFilterPolicy" and then assign it the value '1'

3) Setup remote registry service:

  • open “cmd.exe” as administrator

  • execute the two following commands:

    sc config RemoteRegistry start= auto

    sc start RemoteRegistry

B) Part of Setup to do on linux machine:

1) install the "samba-common" package:

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 windowsmachine from the linux one, run the following command:

net rpc shutdown -f -t 0 -C 'message' -U userName%password -I xxx.yyy.zzz.ttt


  • '-f' means 'force' the shutdown (I think it's mandatory)

  • '-t 0' is the delay before doing it (0 means 'right now').

  • '-U user%password' is the local user and his password on the windows machine (the one that has been alloed to do remote shutdown in point A).

  • '-I' is the IP address of the windows machine to shutdown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.