0

I'm trying to run an update package installation remotely by using the Remoting PowerShell module for SPE. It doesn't install it unless I run it on the SPE console first, and then, remote installations work correctly. Once the app pool is restarted it starts failing again.

This is the script

$SitecoreInstanceUri = "http://sitecoreinstanceurl"
$SitecorePackagePath = "C:\packages\mypackage.update"

#Create a new script session
$session = New-ScriptSession -Username remoteuser -Password b -ConnectionUri $SitecoreInstanceUri

Write-Host "Installing Sitecore update package '$SitecorePackagePath' on '$SitecoreInstanceUri'"

#Invoke the script, actually start installing the package
$jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
    $package = $using:SitecorePackagePath
    Write-Log "Installing Sitecore update package '$package'"
    Install-UpdatePackage -Path $package -UpgradeAction Upgrade -InstallMode Install
} -AsJob -Verbose

#Double check if a jobId was created. If we don't have an id, something is wrong
if (!$jobId) { 
    Write-Host "No jobId was created. Please check if your Powershell Remoting is activated on the target instance '$SitecoreInstanceUri'"
}

#Poll every 5 seconds and check if the script has completed
Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 5 -Verbose

Write-Host "Sitecore update package installed."
Stop-ScriptSession -Session $session

This is the output

Installing Sitecore update package 'C:\packages\mypackage.update' on 'http://sitecoreinstance'

VERBOSE: Checking the Runspace for the variable SitecorePackagePath.
VERBOSE: Checking the Runspace for the variable id.
VERBOSE: Polling job 2078e99e-99b7-4e4c-924c-96f1d84e2727. Status : Available.
VERBOSE: Finished polling job 2078e99e-99b7-4e4c-924c-96f1d84e2727.
VERBOSE: Checking the Runspace for the variable id.
Sitecore update package installed.

On a successful remote installation, it shows lots of lines with the status as Busy, before showing it as Available and finishing the job.

I'd appreciate any help!

7
  • Is it failing because you are updating files? What failure message do you see? – Michael West Jan 7 at 21:18
  • The package contains Sitecore items only, and I don't see any error message, nor in the console or logs. – user3645461 Jan 7 at 21:36
  • How do you know it's failing? – Michael West Jan 7 at 22:02
  • it's not installing it, I don't see any change and the script finishes almost immediately, but when it's a good installation it takes about 4 mins to complete. – user3645461 Jan 7 at 22:17
  • Have you tried with a small package of 1-2 items to see if it works as expected? – Michael West Jan 7 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.