Skip to content

Deleting Resources

Dalmiro edited this page Mar 25, 2016 · 16 revisions

If you are looking for a specific example, leave us a question on Join the chat at https://gitter.im/Dalmirog/OctoPosh


Most of the examples to delete resources on using Octoposh involve

  • Using the get-Octopus** to get the resource you want to delete
  • Piping the resource object to Remove-OctopusResource

None of the examples below include the -force switch to avoid any accidents. If you want to avoid getting prompted every time you delete a resource, pass the switch -Force to Remove-OctopusResource

###Project Groups

Get-OctopusProjectGroup -name "MyProjectGroup" | Remove-OctopusResource

###Projects Delete one project

Get-OctopusProject -name "MyProject" | Remove-OctopusResource

Delete all the projects inside a ProjectGroup

Get-OctopusProjectGroup -name "MyProjectGroup" | Get-OctopusProject | Remove-OctopusResource

###Environments

Get-OctopusEnvironment -name "MyEnvironment" | Remove-OctopusResource

###NuGet Feeds This example removes the reference of an external NuGet feed from Octopus. It doesnt delete any packages from the NuGet feed itself

Get-OctopusFeed -Name "MyFeed" | Remove-OctopusResource

###Library variable sets

Get-OctopusVariableSet -LibrarySetName "MyLibrarySet" | Remove-OctopusResource

###Machines

Get-OctopusMachine -Name "MySQLDatabase" | Remove-OctopusResource

###Lifecycles

Get-OctopusLifecycle -name "MyLifecycle" | Remove-OctopusResource

###Users

$user = Get-OctopusUser -name "MyUser" 
Remove-OctopusResource -resource $user

###Teams

$team = Get-OctopusTeam -name "MyTeam" 
Remove-OctopusResource - resource $team
Clone this wiki locally