Shutting down a Windows Workstation Remotely (from Linux)

Tom O'Connor asked:

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, or is there a tool out there for cross-platform triggering of a shutdown of a windows workstation?

My answer:

How about using the net tool from the Samba package?

For instance:

net rpc shutdown -S workstation1 -U Administrator -w

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

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.