I have a powershell script which is working fine from PowerShell ISE, the script will move the local files to SharePoint 365 documents. When I schedule a SQL server agent job using this script getting the error below. Please advice me what I need to do to run this script.
abc\SQLServiceAcc. A job step received an error at line 10 in a PowerShell script. The corresponding line is 'Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Could not load file or assembly 'file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. '. Process Exit Code -1. The step failed.