Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
@Dalmirog is there a way to interact with the api directly, using custom calls without the use of the defined octoposh methods? (Maintaining the authentication)
Dalmiro Granas

@jigneshjdesai remove-OctopusResource doesn't currently delete releases. I'm on a bus right now so can't get into the specifics of why, but the recommendation would be to use octo.exe delete-release.

I can give you the full explanation later tonight :)

Dalmiro Granas


New-OctopusAPIKey - I simply didn't port this cmdlet after porting things to C#. I have #259 open for it. I'll do it this week as I've been asked about it quite enough :)

Environment question - Not sure Im following this one. Which cmdlet are you running and what you mean by "skip 10"

calling API directly - Yes you can run $c = new-Octopusconnection. Then you could do $c.repository.projects.findall() for example to get all the projects. $c will be an object that holds an authenticated connection with your Octopus instance. Is this what you needed?

@jigneshjdesai about using Octo.exe delete-releases, here's do documentation for it: https://octopus.com/docs/api-and-integration/octo.exe-command-line/deleting-releases

Remember that you can download Octo.exe using Octoposh as explained here: http://octoposh.readthedocs.io/en/latest/advancedexamples/running-deployments-with-octoposh/

@Dalmirog Thank you for your Speedy response, New-OctopusKey would be awesome! , In terms of the environment question, please see image attached
On a side note, is there any way you know of to Use the AD Credentials for User / Password Login, instead of having to prompt the user continuously.
Below is a link that someone had used integrated-Challange (Cookies) to get the login information
Many thanks for your assistance
Dalmiro Granas
@conwayo what was the full scripts you ran when you were getting all those release calls?
Hi @Dalmirog , I am using the Get-OctopusEnvironment Command. It does a recursive 302 Object Moved Response, which intern will go through each and every page of Environment Results verses the direct API call which will return every environment at once. ($env:OctopusDeploy/api/environments)
Any Feedback on the Cookie AD Credential Method ?
@Dalmirog Thank a ton!
Dennis Dyallo
Hi guys. I was looking at Octoposh as an alternative to using the REST Api to get the hostname of the machines I'm deploying to.
Something like;
For some reason $OctopusParameters doesn't include this.
The closest thing is $OctopusParameters['Octopus.Deployment.Machines']
This returns the internal machine Id's like "machine123,machine124".
I'm not sure what use I would have for these, but I came to Octoposh thinking that something like:
Get-OctopushMachine -Id "machine123"
  • would work. Alas, it does not. Where should I be looking to get these hostnames? Should Octoposh be able to take an Id parameter?
Hello, it looks like with the latest Octopus update there may be an incompatibility with the Octopus.Client.dll version. Here is a link to the breaking change that Octopus has identified. https://octopus.com/downloads/compare?from=4.1.8&to=2018.3.4
The version that comes with the module is 4.22.0 and the latest version they use is 4.31.1 . This appears to be breaking a few functions, such as Get-OctopusTeam . Any plans to upgrade to the latest version of Octopus?
@kdiddy82 We ran into this issue as well. I cloned Octoposh from Github, updated the Octoposh projects packages.config to grab version 4.31.1 of Octopus.Client and recompiled the module. This fixed the problem for us. @Dalmirog do you have plans to make this change to the module?

Hello, I need some help with Get-OctopusDeployment. I am using Octopus 3.4.13 and Octoposh 0.6.11.
I have a project and environment that have 34 deployments listed in the DeploymentHistory table in the database. Get-OctopusDeployment throws this error when I try

PS C:\WINDOWS\system32> Get-OctopusDeployment -ProjectName Myproject -EnvironmentName Myproject_prod
Get-OctopusDeployment : Nullable object must have a value.
At line:1 char:1

  • Get-OctopusDeployment -ProjectName Myproject -EnvironmentName Myproject_prod ...
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusDeployment], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusDeployment

Get-OctopusDeployment works fine for other projects with either more or fewer deployments. The project with errors has Successful, Failed and Cancelled deployments. That is also the case with projects that do not have errors.

Is there a main OctopusDeploy channel? Can't seem to find one
@KellyR-STCU there is an Octopus Deploy forum here: https://help.octopus.com/
We're holding our installation at v2018.2.8 after seeing this thread. Anyone know if a perm fix is in the works?
@danielgovier Thanks. It is unfortunate that there is no real time discussion for the main product :)
@Dalmirog I submitted a PR #316 which should fix the issue folks are seeing with the Octopus.Client version after upgrading. I wasn't sure if you were able to take a look or if you need anything else from me for it. Let me know! :smile:
Hi folks - I am wondering if anyone knows of any sample code that can be used to set octopus project variables from code.
Our product has 50 projects and I would love to be able to automate the process of setting up new customers.
I am tired of doing this manually.
Any help greatfully received. Thanks
Could you fix the "EmailAddress" property in OutputOctopusUser.cs that is misspelled "EmailAdress"?
@Dalmirog The project has been quiet for awhile, I wasn't sure if you were able to review my PR #316 yet? We (and I am assuming others) are having to clone and recompile the module internally for updated versions of Octopus Deploy Server which requires the newer Octopus.Client library. This isn't ideal as our preference would be to pull it from the PS Gallery. Is there anything I can do to help?
Stephen Shamakian
@Dalmirog Any update to this? We upgraded our Octopus Server and were forced to upgrade OctoPosh to get Latest Deployments working again but now we can't clone projects anymore.
Stephen Shamakian
@Dalmirog Also when performing a "Get-OctopusProject" to get all projects I keep getting this error "Sequence contains no elements"
Hi all - I was recently observing a colleague adding environments to a Lifecycle phase - he has a lot of envs to add, and I was wondering if Octoposh would be able to do this for us, instead of adding them all in via the GUI? Thanks.
Hello - can anyone advise me on how to use the OctoPosh Update-OctopusVariableSet function? I've imported the OctoPosh module and this function isn't listed. I'm trying to import the JSON export of a variable set from another Octopus instance. Thanks in advance
@StephenShamakian I have a pending PR waiting review which updates the Octopus.Client dependency. At this point you can grab that code and compile it and it should work (far from ideal, I know). We're maintaining it this way internally since we use this module extensively in our CICD pipelines. I am wondering if this project is dead as there hasn't been any activity and none of the pending PR's are being reviewed and merged. I think soon we should look at possibly forking it and maintaining an updated version. I am not a C# developer primarily but given how useful this module is I would be willing to give it a try. Any input from @Dalmirog would be great though!

getting Sequence contains no elements error. I have been trying to use octoposh after a long break doing other things. I installed latest module but have errors on both windows and pwsh that are same with some commandlet vs 2018.4.1 version such as get-octopusenvironment (Get-OctopusProject | select -First 2).Count
Get-OctopusProject : Sequence contains no elements
At line:1 char:2

  • (Get-OctopusProject | select -First 2).Count
  • ~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusProject], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusProject

(Get-OctopusMachine | select -First 2).Count

(Get-OctopusEnvironment | select -First 2).Count
Get-OctopusEnvironment : Sequence contains no elements
At line:1 char:2

  • (Get-OctopusEnvironment | select -First 2).Count
  • ~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusEnvironment], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusEnvironment

(Get-OctopusUser | select -First 2).Count

i am getting this error:

$VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage

OctopusUrl OctopusApiKey

http://octopus.xxx.io API-Dxxxxxxxxxxxxxxxxxxx
Get-OctopusVariableSet : Unable to process response from server: Error converting value "AmazonWebServicesAccount" to type 'Octopus.Client.Model.VariableType'. Path 'Variables[0].Type', line 22, position
40.. Response content: {
"Id": "variableset-LibraryVariableSets-522",
"OwnerId": "LibraryVariableSets-522",
At line:6 char:17

  • ... VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage
  • ~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusVariableSet], OctopusDeserializationException
    • FullyQualifiedErrorId : Octopus.Client.Exceptions.OctopusDeserializationException,Octoposh.Cmdlets.GetOctopusVariableSet

PS C:\WINDOWS\system32>

any ideas?
should i make an issue on github, no one seems to be here
I am trying to use Octoposh to get the latest release of my project with the powershell command and I only see empty lines returned on the call from my powershell script.
Set-OctopusConnectionInfo -Server "http://x.x.x.x/octopus" -ApiKey "API-...."
Get-OctopusRelease -ProjectName "ProjectName" -Latest 1
(returns an empty line of output...)
Is this a known issue?
Hi all - I know that we can use Octoposh to add new environments - can we also add the newly-created Environment to an existing Lifecycle?" thanks in advance for any input!
Larry A

Hi all, I'm running into a similar issue as @danielgovier and wondering if anyone else has a workaround?
Get-OctopusDeployment -Environment "Production" returns
Get-OctopusDeployment : Nullable object must have a value.
At line:1 char:1

+ Get-OctopusDeployment -Environment "Production"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-OctopusDeployment], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusDeployment

whereas Get-OctopusDeployment -Environment "QA" works fine, and if I specify specific project(s) in "Production", Get-OctopusDeployment works fine...Any ideas?


I'm having issue removing Library Variable Set. I'm getting below message:

PS C:\projects\Scripts\Octo> $myLVS = Get-OctopusVariableSet -LibrarySetName 'SngTestLibVarSetB'

PS C:\projects\Scripts\Octo> Remove-OctopusResource -Resource $myLVS.Resource
Dunno what to delete

PS C:\projects\Scripts\Octo> $myLVS

ProjectName            : 
LibraryVariableSetName : SngTestLibVarSetB
ID                     : variableset-LibraryVariableSets-9
Variables              : {}
Usage                  : {}
LastModifiedOn         : 1/01/0001 12:00:00 AM
LastModifiedBy         : 
Resource               : Octopus.Client.Model.VariableSetResource

PS C:\projects\Scripts\Octo> Get-OctopusVariableSet -LibrarySetName 'SngTestLibVarSetB' | Remove-OctopusResource
Dunno what to delete

Reading [https://github.com/Dalmirog/OctoPosh/blob/master/Octoposh/Cmdlets/RemoveOctopusResource.cs], it seems that Remove-OctopusResource supports

 case "Octopus.Client.Model.LibraryVariableSetResource":
                            var libraryVariableSet = (LibraryVariableSetResource)r;

Where $myLVS.Resource is type Octopus.Client.Model.VariableSetResource

PS C:\projects\Scripts\Octo> $myLVS

ProjectName            : 
LibraryVariableSetName : SngTestLibVarSetB
ID                     : variableset-LibraryVariableSets-9
Variables              : {}
Usage                  : {}
LastModifiedOn         : 1/01/0001 12:00:00 AM
LastModifiedBy         : 
Resource               : Octopus.Client.Model.VariableSetResource
Hi there.. I'm trying to use Octoposh inside an AWS lambda and ran into an issue: the .psd1 for the module says that the RootModule is OctoPosh.dll - however I think that AWS lambda is running on a linux host that has case sensitive filesystem. Locally I updated the module to use Octoposh.dll and got further along...
(v 0.6.11)
Nick Moore
octopus-cmdlets> Find-Module -Name Octoposh
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'Octoposh'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\\PSModule.psm1:1397 char:3
+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

octopus-cmdlets> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2


Using Octoposh 0.6.11
Want to add a variable to a list of projects:

$variableset = Get-OctopusVariableSet -Projectname $projectName -ResourceOnly
$newvariable = New-Object Octopus.Client.Model.VariableResource
$scope = New-Object Octopus.Platform.Model.ScopeSpecification

New-Object : Cannot find type [Octopus.Platform.Model.ScopeSpecification]: verify that the assembly containing this
type is loaded.

$newvariable.Name = "newVariable"
$newvariable.Value = "Value"
$newvariable.IsEditable = $true
$newvariable.IsSensitive = $false
$newvariable.Prompt = $null # make this = to $null if you dont want a prompt for this variable
$newvariable.Scope = $null
Update-OctopusResource -Resource $variableset -Force

Looks like I need to load some other Octopus Dlls?
Justin Newman

Using Octoposh 0.6.11
Hi, I'm having an issue when getting the variables for a certain project. The only thing that seems to be different about this project is that there is a runbook attached to it.

Get-OctopusVariableSet : Unable to process response from server: Could not convert string 'ProcessOwner' to
dictionary key type 'Octopus.Client.Model.ScopeField'. Create a TypeConverter to convert from the string to the key type object. Path 'Variables[24].Scope.ProcessOwner', line 360, position 23.. Response content: {
"Id": "variableset-Projects-10",
"OwnerId": "Projects-10",
"Version": 39,
"Variables": [

Michael Wray

Hi all - I'm trying to wipe out all the projects on my dev box, but when I use the provided examples for deleting all projects in a project group it fails - any suggestions?

Get-OctopusProjectGroup -name "MyProjectGroup" gives me an object with the projects in it, so I know I'm reading the projects correctly, but piping that to Get-OctopusProject gives "Parameter set cannot be resolved using the specified named parameters." and trying to expand the projects like Remove-OctopusResource suggests gives an error about it being type string