Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#"Variable Set" is the resource name for both the variables in a project and the ones in a Library Variable Set.
#By passing -Projectname * we make sure we only get variable sets that belong to projects and not to libraries.
Set-OctopusConnectionInfo -Server http://OctoServer -ApiKey API-XXX
$allVariableSets = Get-OctopusVariableSet -projectName *
$valueToSearch = "*var*" #Looking for variables with the word *var* anywhere in their values.
foreach ($variableSet in $allVariableSets)
write-host "running for project [$($variableSet.ProjectName)]"
$variableFound = $false
foreach ($variable in $variableSet.variables)
if ($variable.value -like $valueToSearch)
$variableFound = $true
write-host "The variable [$($] has the value [$($variable.value)]"
if ($variableFound -eq $false)
write-host "No variable was found for project [$($variableSet.ProjectName)]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment