How to use Google Assistant (and others,) to control your PC, Mac, Pi, etc
Need to remotely nuke a folder on your computer? Want to require a second factor before allowing remote desktop communications? Just want to reboot your computer or another because your Plex crashed (very rare, I’ll admit).
There are a variety of ways to do this, but if you’d like it Assistant integrated, meaning you can ask Google/Alexa/Cortana/ to do it while you’re at lunch, with bad internet, there’s a very easy to set up piece of software called TRIGGERcmd you can use to remotely trigger commands on a Mac, PC, Pi, linux distro.
I’m writing about PC/Google Assistant/Home because that’s what I’m on, but it works with Alexa and Cortana out of the box also and can be configured to work on Max, Pi, linux, probably your grandmother’s toaster, etc.
TRIGGERcmd in its free mode works on one computer, and for most this is going to be perfect. I require it to work on more than one (three networks, two computers in one of them,) so I’m paying the $15 a year subscription for it.
Now for me, I’m supporting multiple computers, on call 24/7, and have next to no budget. Work has an accounting system from the 90’s that has not been replicated in a package with a reasonable price (last quote was in the 50k range for two users,) so we have that package on an ancient OS that doesn’t have internet access.
We also have people who work from home, all the time. I get calls to reboot, wipe a cache directory they filled up, check the internet speed at the office, and it generally all happens when I have next to no internet access and am out with the kids.
As I doubt my pain is yours, here’s a quick and dirty way to set up a command to delete that “school projects 2016” folder you’ve got remotely.
So first off you’re going to install TRIGGERcmd on the PC you’re wanting to control. You’ll create an account and get a ridiculously long cloud control key if you haven’t already. Enter cloud key in, test connectivity.
Go ahead and grab your phone and trigger Assistant and say “tell trigger command open notepad.” You’ll link your account, you may get an error the first time, if so ask it again and the second time it works. You can also ask “tell triggerCMD to open notepad” and that will require linking as well. Same service, different name it appears. Both bombed out on first attempt at registering with Google for me, worked on second.
On your PC you’re going to create commands most likely in the GUI editor. “Trigger” is the name of it, “Command” is what you want to run, ground is whether you want to see it or not (probably not for your folder nuking,) “voice” is the command you want, you can define a voice reply if you want it to say something back to you such as “no more kittens will be killed from this folder” and you can also choose whether you pass parameters to it.
For this example, I’m running a batch file.
For reasons, I needed to use start to run the batch file. You may not need this in your command. Just remember if you start a batch file you have to exit it or you end up with an open CMD window (or bunches of them in the background.)
Your batch file in this case would consist of a couple of lines that went something like
@echo time to save the kittens!
rmdir “c:\documents\school projects 2016\” /q /s
@echo the kittens have been saved… for now
You can get fancier and pass parameters and script some fancier things, but we’ll look at that another time.
Should you want to remotely enable and disable remote desktop via assistant you can check out the commands here. Useful for minimizing the chances that someone’s going to discover the ports and potentially get in.
Want to stop or restart a service such as Plex? Here’s a graceful, and ungraceful method.
If you want, you can integrate the commands in a routine (if your assistant supports it,) such as shutting down the Plex when it’s bedtime, starting a morning report on your drive in, powering up your work computer via Wake On Lan when you get near the office (if you’ve got a Pi or another machine sitting there handling wakeup calls,) things of that nature can be integrated fairly simply.