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
#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 | |
Set-OctopusConnectionInfo -Server http://OctoServer -ApiKey API-XXX | |
$VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage | |
foreach($VariableSet in $VariableSets){ | |
Write-Output "`nVariable set [$($VariableSet.LibraryVariableSetName)] is being used by projects" |
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) |
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
$OctopusAPIkey = "" #Octopus API Key to authenticate | |
$OctopusURL = "" #Octopus Server URL | |
$variableSetId = "" #Variable Set Id you want to add to projects | |
#Register the Octopus client and Newtonsoft JSON dlls for all this to work | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Octopus\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Octopus\Octopus.Client.dll" | |
#Create a connection to the Octopus server using the URL and the API Key |