New version and rollback of previous installation

We are distributing with Octopus an ERP setup. What we have accomplished is the following:

  • Create a nuget package that contains Setup.exe and Deploy.ps1 script
  • Execute the package silently while deploying
    At this point the application is successfully installed and from Octopus I can read the installation log raised by my PShell script.
    Now, when we release a new version we should:
  • disinstall the previous installation using a PShell script
  • deploy the new package

What should be a correct implementation of these steps?
I need to call a file from the latest package installed before start the deployment of the new package

This isn’t currently possible to do (you’d have to find the old installation manually and invoke the script).

I’ve opened a ticket here to add the required functionality:


That’s great Paul.
Reading your ticket I just found out that every tentacle has a nice XML file located here:

Can I trust this file and use it?

With the following structure:

<?xml version="1.0" encoding="UTF-8"?>

Sorry but I guess your forum does not allow me to post XML/HTML tags

In case it may be of help I have just wrote down a quite pshell to get the latest version of an installed package:

# read the configuration file
$xmlPath = "C:\Octopus\Applications\.Tentacle\DeploymentJournal.xml"
$xId = "/Deployments/Deployment[@PackageId='YourPackageId' and @WasSuccessful='True']"
[xml]$xml = Get-Content $xmlPath;

# add results to xml array
$xmlResult= $xml.SelectNodes($xId)
$packages = @()
foreach ($project in $xmlResult) {
    $packages += $project

# select package with highest id
$higherRelease = $packages | Sort-Object PackageVersion -Descending | Select-Object -First 1
Write-Host "Found release " $higherRelease.PackageVersion

# disinstall
$currentInstallation = $higherRelease.ExtractedTo

Thanks again for the tip. Of course it would be nice to have this value in a variable instead of parsing the whole XML inside my script.