Hi,
Can you advise om how to remove a script-module and variable-set from all projects in an Octopus server.
We have a deprecated powershell module, i would like to remove programmatically.
I’ve been trying this, and the Remove() method does return TRUE, howevever. The script-module is still added to my project according to gui.
#Easiest way to get these dlls is to find them
#on the tentacle/Octopus install dir like i’m doing here
Add-Type -Path "C:\Users\kbrandenburg\Documents\Octopus\Newtonsoft.Json.dll"
Add-Type -Path “C:\Users\kbrandenburg\Documents\Octopus\Octopus.Client.dll”
$OctopusURL = “my-server”
$APIKey = “my-key”
$endpoint = new-object Octopus.Client.OctopusServerEndpoint ($OctopusURL, $APIKey)
$c = new-object Octopus.Client.OctopusRepository $endpoint
$projects = $c.Projects.FindByName(“Kb.TestProject1”)
foreach ($project in $projects){
$project.IncludedLibraryVariableSetIds.Remove(“LibraryVariableSets-5”)
}
We are running Octopus 3.0.10.2278