To run a PowerShell script using a scheduled task in Windows, you must set the Action to run a Program and configure it as below:
1 Program / Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2 Add arguments (optional) : -file folder_and_file.ps1