1

Invoking RemoteScript block and publishing item on remote server through octopus but getting error.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Import-Module -Name SPE
$secpasswd = ConvertTo-SecureString $OctopusParameters["HttpAuth.Password"] -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($OctopusParameters["HttpAuth.Username"], $secpasswd)
Write-Host "Creating Remote Session"
$session = New-ScriptSession -Username $OctopusParameters["Sitecore.ThemeUploadUser"] -Password $OctopusParameters["Sitecore.ThemeUploadPassword"] -ConnectionUri $SiteUrl -Credential $credential
if ($session -ne $null) {
    write-host "Connected to Sitecore server $sitecoreUrl"
} else {
    write-error "Login failed to Sitecore server $sitecoreUrl for user $(pubUserName)."
}
Write-Host "Invoking Smart Publish Job"

# Smart Publish Site
$jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
        (Publish-Item -Path "master:\" -PublishMode Smart -Recurse -AsJob).Handle.ToString()
}
Write-Host "Waiting for job to finish"
Wait-RemoteSitecoreJob -Session $session -Id $jobId -Delay 30 -Verbose
Write-Host "Job Completed"
Stop-ScriptSession -Session $session

Output getting :

Creating Remote Session

Connected to Sitecore server

Invoking Smart Publish Job

Invoke-RemoteScript : Server response: Not Found

  • $jobId = Invoke-RemoteScript -Session $session -ScriptBlock {

For debugging purpose i checked connection with sitecore and as in the above output it is connecting to sitecore.

I doubt if I am missing any setting on sitecore side. I am working with Sitecore 9.0

Update:

I tried to debug the Invoke-RemoteScript and below is the response:

enter image description here

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.