The D drive needs to be a local drive. It cannot be a mapped network drive.
Create a folder C:\Temp. Grant everyone full control.
Create a file C:\Temp\MyScript.bat. In it put the powershell command that executes the script.
Change the task to execute cmd.exe instead of powershell.exe.
Change the arguments of the script to this:
/c c:\Temp\Myscript.bat 1>c:\temp\MyScript.log 2>&1
That will capture stdout and stderr. Run the task. Check the contents of the log file for errors in the script output.