Skip to content

Instantly share code, notes, and snippets.

@scottcowan
Last active November 25, 2016 17:16
Show Gist options
  • Save scottcowan/384088037afda57c91a05a59a3facda7 to your computer and use it in GitHub Desktop.
Save scottcowan/384088037afda57c91a05a59a3facda7 to your computer and use it in GitHub Desktop.
Move octopus deploy variables between sets
# setup octoposh first
# http://octoposh.net/
$varset = Get-OctopusVariableSet -LibrarySetName "variable set 1" -ResourceOnly
$varset2 = Get-OctopusVariableSet -LibrarySetName "variable set 2" -ResourceOnly
$vars = $varset.Variables | ?{$_.name.StartsWith("AchievementRate")}
foreach ($var in $vars) {$varset2.Variables.Add($var)}
Update-OctopusResource -Resource $varset2
# it's important to use resource only or you'll get an error about fixed collection size
# this doesn't work for secret variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment