1

I'm trying to install and update package through powershell, below is the script. session is successfully created, but when invoking a remote script, I'm getting an error.

Script:

$file = "C:\inetpub\wwwroot\Test\Data\SitecorePackageDeployer\SampleTDSProject.update"
$session = New-ScriptSession -Username prem -Password **** -ConnectionUri http://test
$scriptBlock = [scriptblock]::Create("Start-ScriptSession -ScriptBlock {Install-UpdatePackage -Path $file -UpgradeAction Upgrade -InstallMode Update ; Start-Sleep -Seconds 10; [PSCustomObject]@{'IsComplete'=$true}}")
$job = Invoke-RemoteScript -Session $session -ScriptBlock $scriptBlock

Error:

Exception calling "Invoke" with "1" argument(s): "Element 'Objs' with namespace name 'http://schemas.microsoft.com/powershell/2004/04' was not found. Line 3, position 2."
At C:\Program Files\WindowsPowerShell\Modules\SPE\5.1.0\ConvertFrom-CliXml.ps1:22 char:9
+         $deserializer = $ctor.Invoke($xr)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : XmlException

Exception calling "InvokeMember" with "5" argument(s): "Non-static method requires a target."
At C:\Program Files\WindowsPowerShell\Modules\SPE\5.1.0\ConvertFrom-CliXml.ps1:24 char:16
+ ...      while (!$type.InvokeMember("Done", "InvokeMethod,NonPublic,Insta ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TargetException

enter image description here

2
  • 1
    My fix was to downgrade to Sitecore SPE 5.0. I Hope it will be fixet asap
    – JonasVeng
    Jul 17, 2019 at 8:39
  • Can you provide the details of which version of SPE and SPE Remoting packages you used? Jul 17, 2019 at 19:39

1 Answer 1

1

The issue is most likely related to the fact you are using incompatible versions of the SPE Remoting package and SPE.

  • If you are using SPE 5.1 then you should be using SPE Remoting 5.1.
  • If you are using SPE 5.0 then you should be using SPE Remoting 5.0 (or 5.0.1).

To get the SPE version you can run the following command from within the SPE Console or ISE: $PSVersionTable

enter image description here

To get the SPE Remoting version you can run the following command from with the Windows PowerShell Console or ISE: Get-Module -Name SPE

enter image description here

5
  • How do you check this exactly?
    – geedubb
    Oct 24, 2020 at 13:52
  • 1
    Updated answer with the steps. Oct 24, 2020 at 18:02
  • Thanks for adding the extra details, confirm that we have the correct versions, now I'm hitting an issue where I can see the script tries to hit /sitecore%20modules/PowerShell/Services/RemoteScriptCall.ashx , but it's being redirected to our customer login page and the request returns the HTML not the XML powershell is expecting, so we get the error described in this post. I'll check security setup again but this may be related to the way we have our auth set up for customers
    – geedubb
    Oct 26, 2020 at 15:39
  • 1
    You may check to see if the Spe.IdentityServer.config patch if IS is used. Oct 26, 2020 at 20:16
  • Thanks, yes we are using SI and the patch is enabled
    – geedubb
    Oct 27, 2020 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.