A PowerShell script that looks for a file placed by IFTTT and if found shuts the computer down.
- Create an IFTTT Applet with a "If This" service of your choice as the trigger. In my example I will use an Amazon Alexa trigger but you can use an Email or SMS to trigger the Applet just the same.
-
- For the action service, choose a cloud storage platform of your choice (Dropbox, Google Drive, OneDrive, etc.) I've chosen Dropbox for my example for it's fast desktop sync and the ability to create text files directly with IFTTT. If this is the first time you've used the Dropbox service in IFTTT, you'll have to log in and connect your account.
- Choose the "Create a text file" option.
- For the file name, enter "shutdown". For the content it can be anything it does not matter. And i've set it to place the file in the IFTTT folder in the root of the Dropbox folder.
-
- Optionally rename the applet and click "Finish"
- Download and log into the Dropbox Sync application if it is not already.
- Create a holding place for the Powershell script, I will use "C:\Scripts\Shutdown-PC-via-IFTTT" as this is where I cloned the Git repository
- Edit line 2 to contian the directory of where your IFTTT applet will place the text file in your Dropbox local sync folder
- Edit line 3 to change the Sleeptime between file checks.
- Open "Task Scheduler" and create a standard task
- Give it a name and choose who you'd like to run it as and whether or not you'd like it to run when the computer is not logged in.
- Choose to run with highest privileges
- Run the task hidden
- On the triggers tab, create a new trigger for "At Startup"
- On the actions tab, create a new action to start a program. For the program, enter "powershell.exe". For the Arguments box enter the path to the script file. For example: -file "C:\Scripts\Shutdown-PC-via-IFTTT\Shutdown-Via-IFTTT.ps1"
- Open an administrative powershell prompt and run
Set-ExecutionPolicy Unrestricted
and chooseA
- Run the task manually if you don't wish to reboot
- Trigger your IFTTT applet to test