I may be late to the Windows Media Center party, but now that I’m here, I’m not going home. I love Windows Media Center!

In early 2015 I got an HDHomerun Prime CableCard TV Tuner and set it up to work with Windows Media Center (WMC) on my Windows 7 machine. WMC was on my primary PC until recently because I wanted to upgrade to Windows 10. I migrated my WMC to a Mac Mini running bootcamp and Windows 7. It’s working great! I use WMC extenders to watch TV around my house. My Mac Mini is running headless (that is, there is no monitor, mouse or keyboard attached), so it’s hard to see what its doing unless I remote into it.

I wanted to be able to tell at a quick glance if WMC was busy doing something. That means recording a show, or if someone was using it to watch TV on an extender in the house. I had a spare blink(1) USB RGB LED light, so I decided it needed to become my WMC status light. The thing I love about the blink(1) is how open it is. You can make this USB light turn any color, and program it for any condition. It even works with IFTTT, so it’s uses can be endless.

For my needs, I created a simple PowerShell script to control the light. I wanted it to light up red when a show was recording or someone was using an extender, and green when WMC is idle. I noticed that ehshell.exe is running when WMC is open locally or on an extender. As well as ehrec.exe is running when WMC is recording a show. If a show is scheduled to record then ehrec.exe starts about 5 minutes early. I’m assuming this is the case so it’s ready to record when the time comes. Here’s my PowerShell script:

# # This script is designed to loop forever with a 5 second wait between # each loop. It will check if Windows Media Center is recording # and if it is, then set the blink(1) light to RED. If it is not recording # set the blink(1) light to GREEN. # # This script uses the blink(1) GUI software with the API server enabled. # You could use the blink(1) CLI utility instead if you wanted. I chose # to go with the GUI API so that I could use the GUI if needed. # # Pat O'Brien - http://obrienlabs.net # April 8, 2016 # while($true) { # WMC is open locally or on an extender $wmcshell = Get-Process ehshell -ErrorAction SilentlyContinue # WMC is recording a show $wmcrec = Get-Process ehrec -ErrorAction SilentlyContinue if ( $wmcshell -or $wmcrec) { # Recording a show, set status to red Write-Host "ehshell.exe or ehrec.exe found, setting blink(1) status to red" Invoke-RestMethod -URI "http://localhost:8934/blink1/fadeToRGB?rgb=%23FF0000" } else { # Not recording a show, set status to green Write-Host "ehshell.exe or ehrec.exe not found, setting blink(1) status to green" Invoke-RestMethod -URI "http://localhost:8934/blink1/fadeToRGB?rgb=%2300FF00" } # Sleep for 5 seconds, then check again Start-Sleep -s 5 }

Then I installed the blink(1) Windows GUI software and enabled it to run at startup and also enabled the API Server. blink(1) does have a command line interface, but I like their GUI software since I can remote into the PC and open it at any time and see what color the USB. It’s easy enough to control the light through the HTTP API as well as the command line. It’s your choice on how you want to control it.

Then create a scheduled task to run the PowerShell script at startup. When creating a new task, set the trigger to At startup . The Action is to start a program C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe with the arguments of -noexit -nologo -noninteractive c:\your_script_location\wmc_blink_light.ps1

I rebooted my machine and tested it out. My WMC PC is set to auto login, so these login scripts will run automatically. It went green upon login showing WMC was idle. I then opened up WMC on an extender, I opened it locally. I scheduled some recordings. Light was red. Perfect! The recording I scheduled was for 30 minutes in the future from that point. I closed out and it went green. I waited about 30 minutes or that show to begin recording and it went red about 5 minutes prior to that scheduled recording. I then stopped the recording; it went green. I then started an unscheduled recording; it went green.

It passed all my tests and so far it’s working great! Now I’ll know if its safe to reboot the PC or not!

I know WMC is no longer supported in Windows 10, but the WMC community is pretty awesome, so I’m hoping this helps or inspires someone else!