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