I am trying to schedule a job to run a batch file with Windows 10 Task Scheduler, but it results in return code 2147942401.
The batch file is on remote location so I am giving the absolute path
"\\server1\file transfers\data files\inbound\abc\csv\excel-to-csv.bat"
If I run the batch script with command prompt then it work fine.
The batch script is to convert excel to file to csv.
Content of the script is:
FOR /f "delims=" %%i IN ("\\server1\file transfers\Data Files\Inbound\abc\CSV\*.xlsx" ) DO to-csv.vbs "\\server1\file transfers\Data Files\Inbound\abc\*.xlsx" "%%~ni.csv"
Its calling another VB script which is to-cvs.vbs
If i make changes in Action tab as mention by @Steinspecht(Task scheduler- task completed “successfully” with exit code 0x8007001) then also i am getting the code 2147942401 Not sure whether Add a arguments is written correct
\\server\sharename\folder\file.ext
You only have\server\...
– Galeiform-ExecutionPolicy Bypass
. For some reason I would see an error when running the remote script from an interactive shell, but in the end it decided to tell me:cannot be loaded because you opted not to run this software now
. It also suggests that I use theUnblock-File
cmdlet, but that's not an option in my case (using GPOs to run the script at startup on domain machines) – Hysterotomy