The return code 2147942401 means that there is an error in the action argument in the scheduled task. The action argument field should be in the format -ExecutionPolicy Bypass -File "C:\\Data\\Script.ps1"