Console icon indicating copy to clipboard operation
Console copied to clipboard

Error in Invoke-Remote Script

Open ramzam062086 opened this issue 7 years ago • 2 comments

Expected Behavior

The script below is working fine when installing packages in my local machine sitecore instance but i got an error when i tried it in our dev server.

$session = New-ScriptSession -Username $sitecoreInstanceUserName -Password $sitecoreInstancePassword -ConnectionUri $sitecoreInstanceUri 

$jobDetails = Invoke-RemoteScript -Session $session -ScriptBlock {             
    Install-UpdatePackage -Path $using:package -UpgradeAction Upgrade -InstallMode Install} -Verbose

    Start-Sleep -Seconds 5

if (!$jobDetails) {
    $serverLog = [string]::Format("No jobId was created. Please check if your Powershell Remoting is activated on the target instance: [{0}]",$sitecoreInstanceUri)
    Write-Host $serverLog
}
else{
    $jobDetails
}
    
Stop-ScriptSession -Session $session 

Take note, i got a successful response when doing the below script in our dev server. Import-Module -Name SPE $session = New-ScriptSession -Username 'admin' -Password 'b' -ConnectionUri https://dev1.cm.global.wemshowcase.com

Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -Id admin }

Actual Behavior

Invoke-RemoteScript : Error while opening file 'D:\AgentPool\Utility\Package\KC.WEM.Feature.BuyNow.Core.scitems.update' At D:\AgentPool\Utility\Scripts\Common Scripts\SitecoreSmartPublish.ps1:121 char:19

  • $jobDetails = Invoke-RemoteScript -Session $session -ScriptBlock {
    
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-RemoteScript

Steps to Reproduce the Problem

Installing the same packages in our dev server that running under load balancer.

Please include the version number of SPE and Sitecore. SPE 4.7 & Sitecore 8.2

  • [Yes] Tested issue with clean install of Sitecore and the latest available version of SPE.

  • [NO] Asked questions on the Sitecore Slack Chat channel.

  • [NO] Reviewed questions and answers on the Sitecore Stack Exchange.

ramzam062086 avatar May 30 '18 08:05 ramzam062086

Is this still an issue for you? Doesn't look like all of your error appears in the comment above.

michaellwest avatar Dec 06 '18 23:12 michaellwest

I am also facing same issue.. any options to solve. I am executing this script through octopus server. I tried to enable the powershell remoting on sitecore still same error.

manishmawat avatar Jul 09 '20 20:07 manishmawat