Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

PVE Guest Deletion

Select LXC containers and VMs from one list and destroy them, stopping running guests first.

guest-delete.sh deletes several guests in one go. It lists all containers and VMs of the node, lets you tick the ones to remove and destroys them including their disks.

Website entry: guest-delete. Source: tools/pve/guest-delete.sh.

Run

In the Proxmox VE host shell, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/guest-delete.sh)"

Prompts

PromptChoicesEffect
"This will delete LXC containers and/or VMs. Proceed?"Yes / NoNo ends the script.
"Select LXC containers and VMs to delete:" (checklist with type, name and status)Individual guests, ALL-CT ("Delete ALL containers"), ALL-VM ("Delete ALL VMs")Nothing selected or Cancel shows "No guests selected!" and exits.
Delete guests manually or automatically? (Default: manual) m/a:m or EnterAsks before each guest.
aDeletes every selected guest without further questions.
Delete container <id>? (y/N): or Delete VM <id>? (y/N): (manual mode)yDeletes that guest. Anything else skips it and leaves it running.

If the node has neither containers nor VMs the script shows "No LXC containers or VMs available!" and exits with 234.

What it does

For each confirmed guest:

  1. If it is running, it is stopped with pct stop or qm stop.
  2. It is destroyed:
GuestCommand
Containerpct destroy <id> -f
VMqm destroy <id> --purge --destroy-unreferenced-disks

If a destroy fails, a box shows the last five lines of the command's output and the script continues with the next guest.

Environment variables

VariableDefaultPurpose
COMMUNITY_SCRIPTS_CORE_URLhttps://raw.githubusercontent.com/community-scripts/core/mainBase URL the script loads api/api.func from.

Limits

  • There is no undo. Disks are removed with the guest.
  • Running guests are stopped hard, not shut down.
  • In automatic mode with ALL-CT or ALL-VM ticked, every container or VM on the node is destroyed after a single keypress.
  • Only guests of the node you run the script on are listed.