Is there any way to tell which projects are using which variable sets?

Is there any way to tell which projects are using which variable sets? I’d like to be able to see an overview of all projects that use a Variable Set.

Hi Thomas,

Thanks for getting in touch! There’s an open source module called OctoPosh that provides cmdlets to interact with the API. You can check out the OctoPosh wiki which includes details on all of the available cmdlets.
http://octoposh.readthedocs.io/en/latest/

Using OctoPosh and the Get-OctopusVariableSet cmdlet, you could do something like this.

#The -IncludeUsage switch will populate $VariableSet.Usage with the name of the projects using the LVS
#If -IncludeUsage is not passed, .usage will always be empty

$VariableSets = Get-OctopusVariableSet -LibrarySetName "VariableSetName" -IncludeUsage

foreach($VariableSet in $VariableSets){
    Write-Output "`nVariable set [$($VariableSet.LibraryVariableSetName)] is being used by projects"

    foreach($project in $VariableSet.Usage){
    "--$project"
    }
}

I’ve also made that available here. :slight_smile:

I hope this helps! Let me know if you have any further questions.

Best regards,

Kenny