This is an interesting idea. I may have to do something similar. Thank you for sharing.
The easiest way I've seen to get rid of the PS window popping up is to use a VBScript "helper" to launch the PS script from your scheduled task. The following is from memory, so you may need to tweak it a little.
In this example, C:\Tasks contains your PS script (named PCMotionSensor.ps1 here) and a new VBScript Helper.vbs. Adjust path and filenames as needed.
Task action:
Program - C:\WINDOWS\System32\wscript.exe
Arguments - "C:\Tasks\Helper.vbs"
Contents of Helper.vbs:
Set objShell = CreateObject("Wscript.shell")
objShell.run "powershell -File " & Chr(34) & "C:\Tasks\PCMotionSensor.ps1" & Chr(34), 0
Set objShell = Nothing
Good luck and thanks again for sharing the idea.
Jeff