Created
April 18, 2018 06:00
-
-
Save droyad/d9d6d79cfacbd262b6f320bafb0f1192 to your computer and use it in GitHub Desktop.
Turn ApplyToDynamicallyReferencedPackages on
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
Add-Type -Path 'C:\Program Files\Octopus Deploy\Octopus\Octopus.Client.dll' | |
$octopusURI = 'http://myserver' # Your server address | |
# Create using API key | |
# $endpoint = new-object Octopus.Client.OctopusServerEndpoint $octopusURI,'API-GHRWGHEWJGHWJEGHW' # Get this from your profile | |
# $repository = new-object Octopus.Client.OctopusRepository $endpoint | |
# OR create using username/password | |
$endpoint = new-object Octopus.Client.OctopusServerEndpoint $octopusURI | |
$endpoint.Proxy = [System.Net.WebProxy]::GetDefaultProxy() | |
$repository = new-object Octopus.Client.OctopusRepository $endpoint | |
$repository.Users.SignIn("Admin", "password"); | |
$url = $repository.Client.RootDocument.Links["RepositoryConfiguration"].AsString() | |
$getMethod = $repository.Client.GetType().GetMethod("Get") | |
$genericGetMethod = $getMethod.MakeGenericMethod([object]) | |
$config = $genericGetMethod.Invoke($repository.Client, @($url, $null)); | |
$config.ApplyToDynamicallyReferencedPackages = $true | |
$postMethod = $repository.Client.GetType().GetMethods() | where { $_.Name -eq "Put" } | where { $_.GetParameters().Length -eq 2 } | |
$genericPostMethod = $postMethod.MakeGenericMethod($config.GetType()) | |
$genericPostMethod.Invoke($repository.Client, @($config.Links["Self"].ToString(), $config)) | |
$genericGetMethod.Invoke($repository.Client, @($url, $null)).ToString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment