A small app to shutdown headless computers via UDP, and why we developed it.
PC Network Shutdown

Computers in AV Systems

Update 6/18/2021- Link to Crestron module will direct you to a GitHub page for an app installer for the listening application.

MSIX Installer for Win 10

GitHub Repo w/ a Release that can be downloaded and run without MSIX installation

All of the AV systems I’ve worked on recently include at least one  computer.  Because Windows computers are so general-purpose and  typically inexpensive, they can be used for interactive touchscreen  kiosks, video playback, audio playback, or many other useful functions.

However, one thing computers don’t do well, is listen to control systems (at least out of the box).
The most essential function of an AV control  system is to turn everything on at the start of the day, and turn  everything off at the end of the day.  Not only does this protect the  equipment (especially monitors and projectors), but it is also the green  thing to do.  Everyone is paying more attention to reducing power  consumption, particularly when the system is not even being used.  So we  want to be able to turn non-essential computers on and off, too.  And,  it turns out this is not as easy as it should be.  This post describes  the ways that I have developed to handle this problem gracefully.

Startup

This is the easier of the two problems.  Most modern computers  include include a BIOS setting that allows you to prevent completely  turning the off the power to the ethernet adapter, and the network  adapter will respond to a Wake-On-LAN magic packet  over the network.  Even when the computer is turned off, you can power  it up, by sending out a special command that includes the MAC address of  the computer.  I have written a Crestron module, and a C# library to perform this function, and you are free to use them and see how it works.

Some older computers do not have network adapters or power supplies  that support Wake-On-LAN.   In this case, you can punt and set the BIOS  to turn the computer on a specific time of day.  Even if you don’t know  exactly when it needs to be on, you can still reduce the computer’s duty  cycle by judiciously setting a daily startup time.

Shutdown

This is actually the difficult part.  I couldn’t find any way to tell  a Windows computer to shutdown on command.  You would think this should  be easy, but computers are designed to protect the user form the  outside world by default, so they don’t let anybody tell them what to  do.

So, I wrote a small C# console application that runs in the  background and listens on a well-defined network port to incoming  messages.  When it gets a “SHUTDOWN\x0D\x0A” message (with CR and LF  appended), it issues the shutdown command to the operating system.  This  could work on any operating system, but I’ve implemented it for Windows  and the critical line of code looks like this:

System.Diagnostics.Process.Start("shutdown", "/s /f /t 3 /c \"Control System Triggered Shutdown\" /d p:0:0");

The compiled application is called NetworkShutdown.   Unzip it and put a copy on the computer you want to control, and add a  shortcut to it to the Startup folder.  You also need to make sure that  UDP port 16009 is open in the Windows Firewall.

Then, any control system that can send UDP packets can be used to  control this computer.  For example, using Crestron just send an ASCII  string like this:

Crestron Example

Conclusion

At the end of the day, it doesn’t take that much more programming  work to ensure that computers can be turned on and off with your media  system, and you can save a lot of energy in the process.  When being  green is easy, why not?

Project Photos