Powershell scheduler does not launch a .ps1 script

Bumped into the following problem: writing a *.ps1 script in Windows and launching it with Task Scheduler resulted in opening the script in a notepad.

Adding script name as an argument to a Powershell executable in task properties resulted in 0x1 error code.

The problem solved after adding script directory (marked ‘optional’) in “Edit Action” and changing the ‘Configure for’ to ‘Windows 10’ in General tab.

Note to whoever reads this: consider switching to Linux. Just saying..