Adding a new Variable to a Project

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.

It looks like I need specific Octopus Dlls for the Octoposh scripts to run.
Any ideas please?

Hi @terry.ninnis,

Thanks for getting in touch!

The Octoposh module isn’t actively maintained anymore, so this issue could be due to compatibility issues with newer versions of Octopus.

We do have a repository of useful scripts for the octopus.client available here.
This one, in particular, will allow you to add or update a variable within a single project. You should be able to amend it to loop through a list of projects.

Regards,
Paul

Thanks Paul,
That works perfectly.

1 Like