List packages for a Release


I am scripting a process to move all the packages that were deployed in a release to a archive folder. To get all the packages for the project i am trying to use

Add-Type -Path “D:\PowershellScripts\DLLS\Octopus.Client.dll”
$endpoint= New-Object Octopus.Client.OctopusServerEndpoint “oct URL”,“API-KEY-xx”
$repository=new-object Octopus.Client.OctopusRepository $endpoint

STUDYARCHIVE1 is the project name.

The URL for the project in web i see for the project is


I also tried to use Octoposh commands
$Releases=Get-OctopusDeployment -ProjectName “study-studyarchive1”

but not getting any results.

Can someone point me in the right direction on how this can be done.

Hi Pavan,

Thanks for getting in touch! OctoPosh unfortunately won’t be of any help in achieving this. I think the easiest way would be to take advantage of some built-in system variables where you can retrieve the path and package id and version. Maybe Octopus.Tentacle.CurrentDeployment.PackageFilePath (which will return something like C:\Octopus\Tentacle\Packages\OctoFx.1.2.3.nupkg) would contain the value needed. You can refer to the following documentation page for additional information and a list of all system variables available.

Using these values, you can then use a PowerShell script to move them however you need to. Would this help meet your requirements? Let me know what you think and if you have any further questions going forward. :slight_smile:

Kind regards,


Thank you Kenny

So i have created PS script that i am executing as part of a octopus project on the deployment target.
I think i am not getting any value for OctopusPackagePath as I get Path is null error when this script is executed. I was hoping OctopusPackagePath would have folder reference to C:\Octopus\Files which has all the packages

$CopyDir = “C:\TempPackages”
If(!(Test-Path $CopyDir)){
New-Item $CopyDir -ItemType Directory -verbose
#Move packages from Octopus Folder to Archive
Move-Item -Path $OctopusPackagePath -Destination $CopyDir

Hi Pavan,

Thanks for following up! This variable evaluates to a single file (the package which is deployed to C:\Octopus\Files in this specific deployment). It’s not returning a directory which is why the message says the path is null. You could try moving the package itself using this variable, or if you want to copy the entire directory I’ve had success with your script by changing the $OctopusPackagePath variable to equal “C:\Octopus\Files”.

I hope this helps get you going! Let me know if you have any further questions going forward. :slight_smile:

Kind regards,


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.