Tuesday, April 26, 2016

Exception calling "add" with "2" argument during File upload in SharePoint site using Remote Powershell as Symantec protection for SharePoint is enabled

File upload in SharePoint using Remote Powershell does not work if Symantec protection for SharePoint is scanning file.



Here is the example where I am uploading file.txt into my SharePoint site https://siteURL  using remote powershell to SharePoint server. If I disable real-time scan, it works fine, otherwise it error out like below exception and error in SPSS system log.

$cred=get-Credential
$s=new-PSsession “ServerName” -authentication credssp -credential $cred
Invoke-Command -Session $s -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell;$site = get-spsite https://SiteURL;$site.RootWeb.Lists['Documents'].RootFolder.Files.Add('file.txt', (ls \\NetworkPath\file.txt)[0].OpenRead())}


Cause: this is a bug with SPSS

Solution:

Ask Symantec support to provide the patch file which replaces following files in installation and GAC directory and stop/start IIS, SPSS service on all SP server. This will allow SharePoint to upload files using remote powershell:


i)        Symantec.Sharepoint.RTCommandClient.dll

ii)      Symantec.Sharepoint.SPSSService.exe