Removing Library Variable Sets via API


we are trying to loop through a set of projects and remove a Library Variable Set, Can you able provide an alternative for below
$project.IncludedLibraryVariableSetIds -= $librarySet.Id

Basically Need an undo script for the below script


Thanks for reaching out, and I would be happy to help with your request!

As an initial step, I looked around and could not find an existing script for this in our Octopus API GitHub repository, so I went ahead and wrote a PowerShell script for this, which you can find at the following link:

You’ll need to supply the working variables at the top of the script, but once filled out, this script will remove a specific library variable set from a project. Although I’ve done some testing with this script and things worked as expected on my end, I recommend testing this against a sample before running it against production resources.

This script is limited to running against a single project, but you can adjust this to be more encompassing by modifying the filters at the top of the script as needed.

I hope this helps,


Thank you @britton.riggs, Have tested this script in test environment and working fine. Thanks for that again.