Created
September 19, 2017 04:34
-
-
Save KennethBates/5ea63c01d9ac3813a4b329b89d15bf83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#"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 [$($variable.name)] 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