> For the complete documentation index, see [llms.txt](https://docs.prismacloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prismacloud.io/admin-guide/install/deploy-defender/uninstall-defender.md).

# Uninstall Defenders

Prisma Cloud automatically uninstalls Defenders that haven’t connected to the Prisma Cloud console for more than a day. Removing the stale Defenders helps keep your view of the environment clean, where you can see the list of connected Defenders for any given 24-hour window, and conserves licenses. The refresh period can be configured up to a maximum of 365 days under **Manage > Defenders > Settings > Automatically remove disconnected Defenders after (days)**.

You can uninstall the decommissioned Defenders from the Console UI or by using the Prisma Cloud API.

We recommend that you let Prisma Cloud automatically uninstall stale Defenders rather than using the UI or API. Automatic removal is recommended in large scale environments.

## Delete Defenders Manually

**Delete Defenders from Console**

* Go to **Manage > Defenders: Deployed** to see a list of all the Defenders connected to Console.
* Under **Actions**, select **Delete** next to the respective Defender.

**Delete Defenders using the API**

The following endpoint can be used to delete a Defender.

**Path**

```
DELETE /api/v1/defenders/[hostname]
```

Refer to the [Delete a Defender API](https://pan.dev/compute/api/delete-defenders-id/) for more information.

## Force Uninstall Defender

If a Defender instance is not connected to Prisma Cloud console, or is otherwise not manageable through the UI, you can manually remove it.

Go to the Linux host where the Container Defender runs and use the following command:

```
$ sudo /var/lib/twistlock/scripts/twistlock.sh -u
```

If you run this command on the same Linux host where Prisma Cloud console is installed, it also uninstalls Prisma Cloud console.

On the Linux host where Host Defender runs, use the following command:

```
$ sudo /var/lib/twistlock/scripts/twistlock.sh -u defender-server
```

On the Windows host where Defender runs, use the following command:

```
C:\Program Files\Prisma Cloud\scripts\defender.ps1 -uninstall
```

## Uninstall all Prisma Cloud Resources in a Kubernetes Environment

To uninstall all Prisma Cloud resources from a Kubernetes-based deployment, delete the `twistlock` namespace. Deleting this namespace deletes every resource within the namespace.

1. Delete the *twistlock* namespace.

   ```bash
   $ kubectl delete namespaces twistlock
   ```
2. Clean up Cluster roles and role bindings

   ```bash
   $ kubectl delete clusterrole twistlock-view
   $ kubectl delete clusterrolebinding twistlock-view-binding
   ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.prismacloud.io/admin-guide/install/deploy-defender/uninstall-defender.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
