[英]unable to run sharepoint powershell script from sql server agent job
I have a powershell script which is working fine from PowerShell ISE, the script will move the local files to SharePoint 365 documents. 我有一个Powershell脚本,可以从PowerShell ISE正常工作,该脚本会将本地文件移动到SharePoint 365文档。 When I schedule a SQL server agent job using this script getting the error below.
当我使用此脚本计划SQL Server代理作业时,出现以下错误。 Please advice me what I need to do to run this script.
请告诉我运行该脚本所需的操作。
abc\\SQLServiceAcc.
abc \\ SQLServiceAcc。 A job step received an error at line 10 in a PowerShell script.
作业步骤在PowerShell脚本的第10行收到错误。 The corresponding line is 'Add-Type -Path "C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\15\\ISAPI\\Microsoft.SharePoint.Client.dll"'.
相应的行是“添加类型-路径“ C:\\ Program Files \\ Common Files \\ Microsoft Shared \\ Web服务器扩展\\ 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.
PowerShell返回的错误信息是:'无法加载文件或程序集'file:/// C:\\ Program Files \\ Common Files \\ Microsoft Shared \\ Web服务器扩展\\ 15 \\ ISAPI \\ Microsoft.SharePoint.Client.dll”或它的依赖项之一。 This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
该程序集是由比当前加载的运行时新的运行时构建的,无法加载。 '.
'。 Process Exit Code -1.
处理退出代码-1。 The step failed.
该步骤失败。
It depends how you are running the script and which version of SQL Server you are using. 这取决于您如何运行脚本以及所使用的SQL Server版本。
Look at http://www.travisgan.com/2013/05/sql-server-agent-job-and-powershell.html 看看http://www.travisgan.com/2013/05/sql-server-agent-job-and-powershell.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.