Note: You must have permission to run script see ExecutionPolicy
Then in Task Scheduler, the most important/tricky part is the "Action"
It should be "Start a Program"
Add arguments (optional) :
- If you see "-File" on the internet, it will work, but understand nothing can be after "-File" exept the File Path, IE: The redirect is taken to be part of the file path and it fails, you must use "-command" in conjunction with redirect, but you can prepend additional commands/arguments such as "-windowstyle hidden" to not show powershell window.
- I had to adjust all "Write-Host" to "Write-Output"