[英]SharePoint document upload using PowerShell REMOTE
这个问题不仅仅与使用PowerShell上传文档有关,而且还集中在“远程”上。
我现在有2台服务器,
我们正在使用CredSSP进行身份验证,到目前为止,所有任务都能正常运行,例如操作列表/项目。 但是在这里上传文档是一个障碍。
要上传的文件位于本地的SharePoint服务器上。
如果我直接在SharePoint服务器中运行,invoke-command中的脚本块将很好地工作
使用的脚本:
$credsspSession=New-PSSession -cn $SPServer-Authentication Credssp -Credential $credentail
icm -session $credsspSession {
Add-PSSnapin "Microsoft.sharepoint.powershell"
$spweb=Get-SPWeb "https://siteURL"
$file=Get-Item "filename"
$spFolder=$spweb.GetFolder("FolderName")
$fileCollection=$spFolder.Files
$fileCollection.Add("FolderName/file.name",$file.OpenRead(),$false)
}
错误消息报告:
PSMessageDetails :
Exception : System.Management.Automation.MethodInvocationException: Exception calling "Add" with "3" argument(s): "" ---> Microsoft.SharePoint.SPException
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Stream file, Boolean overwrite, String checkInComment, Boolean checkRequiredFields)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Stream file, Boolean overwrite)
at CallSite.Target(Closure , CallSite , Object , String , Object , Boolean )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : SPException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 9
PipelineIterationInfo : {}
PSComputerName : fe0vm1074
RunspaceId : 3ca5166e-c28d-4dc5-a9f6-0d31091106f4
有什么想法吗? 谢谢你的提示。
结果,这被确定为“赛门铁克”问题,它阻止了我的远程Powershell上载文档。 安装“ Symantec Patch”(由Symantec提供,由我的同事安装)后,问题已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.