# KEPM Collection Commands

### Overview

This section covers all the Keeper Commander commands for managing KEPM collections. Collections group resources such as users, machines, applications, and other entities that can be used in policy filters. These commands allow administrators to create, view, update, delete, and manage links between collections and other KEPM entities.

This section supports the following commands:

* [**Collection List Command**](#collection-list-command)
* [**Collection View Command**](#collection-view-command)
* [**Collection Add Command**](#collection-add-command)
* [**Collection Update Command**](#collection-update-command)
* [**Collection Delete Command**](#collection-delete-command)
* [**Collection Connect Command**](#collection-connect-command)
* [**Collection Disconnect Command**](#collection-disconnect-command)
* [**Collection Wipe Out Command**](#collection-wipe-out-command)

### Usage

`pedm collection command [--options]` OR `pedm c command [--options]`

**Alias:** `c`

***

### Collection List Command

View all KEPM collections with optional filtering by type or search pattern. Collections can represent various resource types including OS builds, applications, user accounts, group accounts, and custom collections.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection list`&#x20;

**Parameters**:

<table><thead><tr><th width="211">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>--type</code></td><td>Filter by collection type number.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```bash
My Vault > epm-collection list
My Vault > epm-collection list --type 2
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

{% code expandable="true" %}

```csharp
// Get all collections
IEnumerable<EpmCollection> allCollections = plugin.Collections.GetAll();

// Filter by type
var appCollections = plugin.Collections.GetAll()
    .Where(c => c.CollectionType == (int)EpmCollectionType.Application);

// Get a single collection by UID
EpmCollection collection = plugin.Collections.GetEntity(collectionUid);

// Read decoded name from collection data
string name = "";
if (collection.CollectionData != null && collection.CollectionData.Length > 0)
{
    var data = JsonUtils.ParseJson<Dictionary<string, object>>(collection.CollectionData);
    if (data.TryGetValue("Name", out var nameObj))
        name = nameObj?.ToString();
}
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Get-KeeperEpmCollectionList`&#x20;

**Alias**: `kepm-collection-list`&#x20;

**Parameters**:

<table><thead><tr><th width="235">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionType</code></td><td>Filter by collection type number.</td></tr></tbody></table>

**Collection Types:**

| Value | Name          |
| ----- | ------------- |
| 1     | OS Build      |
| 2     | Application   |
| 3     | User Account  |
| 4     | Group Account |
| 202   | OS Version    |

**Examples**:

{% code expandable="true" %}

```ps1
PS > Get-KeeperEpmCollectionList
zONY29QGSmCZAQ0l5UXJfA Type 102       TestNEW
0NNRTG9a4JTZ32LzfIO6FQ Type 103       TestBy1
GF2zrxVgl8Pj7dcbh9hJwg OS Version     macOS 26
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection list`

**Aliases:** `pedm c l`, `pedm c list`

**Flags:**

| Flag            | Description                          |
| --------------- | ------------------------------------ |
| `-v, --verbose` | Show detailed collection information |
| `--type`        | Filter by collection type (integer)  |
| `--pattern`     | Search pattern for collection names  |
| `--format`      | Output format - json, csv, or table  |
| `--output`      | Save output to specified file        |

**Example:**

```
My Vault> pedm collection list --type 101

Collection UID: coll_abc123
Value: Name=Windows Servers
Link Count: 5
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)
plugin.collections.get_all_entities()
```

</details>

### Collection View Command

Display detailed information about specific collections including their type, values, and associated links to agents, policies, or other collections.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection view`&#x20;

**Parameters**:

<table><thead><tr><th width="194.99993896484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID or name (case-insensitive).</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```
My Vault > epm-collection view abc123uid
My Vault > epm-collection view "My Collection"
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
// Get all collections
IEnumerable<EpmCollection> allCollections = plugin.Collections.GetAll();

// Filter by type
var appCollections = plugin.Collections.GetAll()
    .Where(c => c.CollectionType == (int)EpmCollectionType.Application);

// Get a single collection by UID
EpmCollection collection = plugin.Collections.GetEntity(collectionUid);

// Read decoded name from collection data
string name = "";
if (collection.CollectionData != null && collection.CollectionData.Length > 0)
{
    var data = JsonUtils.ParseJson<Dictionary<string, object>>(collection.CollectionData);
    if (data.TryGetValue("Name", out var nameObj))
        name = nameObj?.ToString();
}
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Get-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-view`&#x20;

**Parameters**:

<table><thead><tr><th width="287">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUidOrName</code></td><td>Collection UID or name (case-insensitive).</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```ps1
PS > Get-KeeperEpmCollection zONY29QGSmCZAQ0l5UXJfA
Collection: zONY29QGSmCZAQ0l5UXJfA
  Type: Type 102
  Created: 2026-05-05 10:42:40
  Name: TestNEW
  IsCustom: True

  Linked Agents (1):
    jhIsUYwxz6Y6cBFHz06Ukw  (OidIJAZhpLwwbsu3TKK_66Ti8ulC8rJKlG1OEdF_IWk)

  Linked Policies (1):
    ebZZya9XhEXvlsUNjtmLcA

  Linked Collections (3):
    EW8bzYtBPJosLtm8C7lNqA
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection view <collection> [collection...]`

**Aliases:** `pedm c v`, `pedm c view`

**Flags:**

| Flag            | Description                                           |
| --------------- | ----------------------------------------------------- |
| `-v, --verbose` | Show verbose information                              |
| `--link`        | Show details for specific link UIDs - can be repeated |
| `--format`      | Output format - json, csv, or table                   |
| `--output`      | Save output to specified file                         |
| `collection`    | Collection UID (required, can specify multiple)       |

**Example:**

```
My Vault> pedm collection view coll_abc123

Collection UID: coll_abc123
Collection Type: MACHINE (101)
Collection Value: Name=Windows Servers
Link Count: 5
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)
plugin.collections.get_entity(uid)
```

</details>

### Collection Add Command

Create new custom collections for grouping resources. Collections can be used in policy filters to target specific sets of users, machines, or applications.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection add`&#x20;

**Parameters**:

<table><thead><tr><th width="208.99993896484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID.</td></tr><tr><td><code>--type</code></td><td>Collection type (1=OS Build, 2=Application, 3=User Account, 4=Group Account, 202=OS Version).</td></tr><tr><td><code>--data</code></td><td>Collection data as a JSON string.</td></tr><tr><td><code>--data-file</code></td><td>Path to a file containing collection data JSON.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```bash
My Vault > epm-collection add --type 2 --data '{"Name":"Chrome","Version":"120"}'
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
public async Task<ModifyStatus> ModifyCollections(
    IEnumerable<CollectionData> addCollections = null,
    IEnumerable<CollectionData> updateCollections = null,
    IEnumerable<string> removeCollections = null)
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Add-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-add`&#x20;

**Parameters**:

<table><thead><tr><th width="217">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUid</code></td><td>Collection UID.</td></tr><tr><td><code>-CollectionType</code></td><td>Collection type (1=OS Build, 2=Application, 3=User Account, 4=Group Account, 202=OS Version). </td></tr><tr><td><code>-Data</code></td><td>Collection data as a JSON string.</td></tr><tr><td><code>-DataFile</code></td><td>Path to a file containing collection data JSON.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```ps1
PS >  Add-KeeperEpmCollection -CollectionType 2 -Data '{"Name":"Chrome","Version":"120"}'
Generated Collection UID: tbbwqMM3UbVPD_NQb4JSkQ
Collection 'tbbwqMM3UbVPD_NQb4JSkQ' added.
  Added: tbbwqMM3UbVPD_NQb4JSkQ
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection add <collection_name> [collection_name...]`

**Aliases:** `pedm c a`, `pedm c add`

**Flags:**

| Flag         | Description                                      |
| ------------ | ------------------------------------------------ |
| `--type`     | Collection type (required, integer)              |
| `collection` | Collection name (required, can specify multiple) |

**Example:**

```
My Vault> pedm collection add "Finance Users" "HR Users" --type 103

Collection created successfully
Collection UID: coll_new123
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)

collection: Any = ['Collection names']
collection_type = int #'Collection type'

if isinstance(collection, str):
    collection = [collection]

collections: Dict[str, admin_types.CollectionData] = {}
for c in collection:
    collection_uid = utils.generate_uid()
    collection_data = {
        'Name': c,
        'IsCustom': True
    }
    collections[collection_uid] = admin_types.CollectionData(
        collection_uid=collection_uid, collection_type=collection_type,
        collection_data=json.dumps(collection_data))

status = plugin.modify_collections(add_collections=collections.values())
```

</details>

### Collection Update Command

Modify the name of an existing collection. This command allows administrators to update collection names without recreating them or affecting their links.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection update`&#x20;

**Parameters**:

<table><thead><tr><th width="194.00006103515625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>--type</code></td><td>New collection type.</td></tr><tr><td><code>--data</code></td><td>Collection data as a JSON string.</td></tr><tr><td><code>--data-file</code></td><td>Path to a file containing collection data JSON.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```bash
My Vault > epm-collection update abc123uid --data '{"Name":"Chrome","Version":"121"}'
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
public async Task<ModifyStatus> ModifyCollections(
    IEnumerable<CollectionData> addCollections = null,
    IEnumerable<CollectionData> updateCollections = null,
    IEnumerable<string> removeCollections = null)
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Update-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-edit`&#x20;

**Parameters**:

<table><thead><tr><th width="218.99993896484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUidOrName</code></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>-CollectionType</code></td><td>New collection type.</td></tr><tr><td><code>-Data</code></td><td>Collection data as a JSON string.</td></tr><tr><td><code>-DataFile</code></td><td>Path to a file containing collection data JSON.</td></tr></tbody></table>

**Example:**

{% code expandable="true" %}

```ps1
PS > Update-KeeperEpmCollection "tbbwqMM3UbVPD_NQb4JSkQ" -Data '{"Name":"Chrome","Version":"121"}'
Collection 'tbbwqMM3UbVPD_NQb4JSkQ' updated.
  Updated: tbbwqMM3UbVPD_NQb4JSkQ
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection update <collection>`

**Aliases:** `pedm c u`, `pedm c update`

**Flags:**

| Flag         | Description                                    |
| ------------ | ---------------------------------------------- |
| `--name`     | New collection name (required)                 |
| `--type`     | Collection type (optional, for disambiguation) |
| `collection` | Collection UID or name (required)              |

**Example:**

```
My Vault> pedm collection update coll_abc123 --name "Updated Server Group"

Collection updated successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)

new_name = 'rename collection'
collection_id = 'collection name or uid'
collection = plugin.collections.get_entity(collection_id)
collection_info = collection.collection_data
collection_info['Name'] = new_name
collection_data = admin_types.CollectionData(
    collection_uid=collection.collection_uid, collection_type=collection.collection_type,
    collection_data=json.dumps(collection_info))

status = plugin.modify_collections(update_collections=[collection_data])
```

</details>

### Collection Delete Command

Remove one or more collections from the system. This command supports deleting specific collections or using special values like @orphan\_resource to clean up orphaned resource collections.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection remove`&#x20;

**Parameters**:

<table><thead><tr><th width="194.00006103515625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID or name (case-insensitive).</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```bash
My Vault > epm-collection delete "My Collection"
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
public async Task<ModifyStatus> ModifyCollections(
    IEnumerable<CollectionData> addCollections = null,
    IEnumerable<CollectionData> updateCollections = null,
    IEnumerable<string> removeCollections = null)
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Remove-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-delete`&#x20;

**Parameters**:

<table><thead><tr><th width="244">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUidOrName</code></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>-Force</code></td><td>Skip confirmation prompt before delete.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```ps1
PS > Remove-KeeperEpmCollection "tbbwqMM3UbVPD_NQb4JSkQ"

Confirm
Are you sure you want to perform this action?
Performing the operation "Delete" on target "collection 'Chrome'".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
Collection 'tbbwqMM3UbVPD_NQb4JSkQ' removed.
  Removed: tbbwqMM3UbVPD_NQb4JSkQ
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection delete <collection> [collection...]`

**Aliases:** `pedm c delete`

**Flags:**

| Flag          | Description                                                                   |
| ------------- | ----------------------------------------------------------------------------- |
| `-f, --force` | Do not prompt for confirmation                                                |
| `collection`  | Collection UID or name, or @orphan\_resource (required, can specify multiple) |

**Examples:**

```
My Vault> pedm collection delete coll_old123 --force

Collection deleted successfully
```

```
My Vault> pedm collection delete @orphan_resource

Do you want to remove 3 collection(s)? (y/N): y
Collections deleted successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)

collection_id = 'collection name or uid'
collection = plugin.collections.get_entity(collection_id)

uids = [collection.uid]
status = plugin.modify_collections(remove_collections=uids)
```

</details>

### Collection Connect Command

Link entities (agents, policies, or other collections) to a collection. This command establishes relationships between collections and PEDM entities for policy filtering and organisation.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection connect`&#x20;

**Parameters**:

<table><thead><tr><th width="199">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>--link-type</code></td><td>Type of link: <code>agent</code>, <code>policy</code>, or <code>collection</code>.</td></tr><tr><td><code>--link</code></td><td>One or more UIDs or names to link.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```bash
My Vault > epm-collection connect abc123uid --link-type agent --link agent-uid-1
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
public async Task<ModifyStatus> SetCollectionLinks(
    IEnumerable<CollectionLink> setLinks = null,
    IEnumerable<CollectionLink> unsetLinks = null)
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Connect-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-connect`&#x20;

**Parameters**:

<table><thead><tr><th width="292">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUidOrName</code></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>-LinkType</code></td><td>Type of link: <code>agent</code>, <code>policy</code>, or <code>collection</code>.</td></tr><tr><td><code>-LinkUid</code></td><td>One or more UIDs or names to link.</td></tr></tbody></table>

**Example**:

{% code expandable="true" %}

```ps1
PS > Connect-KeeperEpmCollection "Xgnlz6kDlNfdf8PlgV30ow" -LinkType agent -LinkUid "ah5j2UEjjDP5Y8oXdNaw3A"
1 link(s) connected.
  Added: Xgnlz6kDlNfdf8PlgV30ow
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection connect <links> [links...]`

**Aliases:** `pedm c connect`

**Flags:**

| Flag               | Description                                            |
| ------------------ | ------------------------------------------------------ |
| `-c, --collection` | Parent collection UID or name (required)               |
| `--link-type`      | Type of link - agent, policy, or collection (required) |
| `links`            | Link UIDs or names (required, can specify multiple)    |

**Example:**

```
My Vault> pedm collection connect agent_abc123 agent_def456 --collection coll_servers --link-type agent

Links created successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin, admin_types
from keepersdk.proto import pedm_pb2

plugin = admin_plugin.PedmPlugin(enterprise_loader)

collection_id = 'collection name or uid'
collection = plugin.collections.get_entity(collection_id)


link_types = ['agent', 'policy', 'collection']
link_type = link_types[0]
link_name = 'link name or uid'

links: List[str] = []
collection_link_type: int
if link_type == 'collection':
    coll_links = plugin.collections.get_entity(link_name)
    links.extend((x.collection_uid for x in coll_links))
    collection_link_type = pedm_pb2.CLT_COLLECTION
elif link_type == 'agent':
    agent = plugin.agents.get_entity(link_name)
    links.append(agent.agent_uid)
    collection_link_type = pedm_pb2.CLT_AGENT
elif link_type == 'policy':
    pol_links = plugin.policies.get_entity(link_name)
    links.extend((x.policy_uid for x in pol_links))
    collection_link_type = pedm_pb2.CLT_POLICY

to_add = [admin_types.CollectionLink(
    collection_uid=collection.collection_uid, link_uid=x, link_type=collection_link_type) for x in links]

status = plugin.set_collection_links(set_links=to_add)
```

</details>

### Collection Disconnect Command

Remove links between a collection and its associated entities. This command unlinks agents, policies, or collections from a parent collection without deleting the entities themselves.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection disconnect`&#x20;

**Parameters**:

<table><thead><tr><th width="200">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em>(positional)</em></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>--link</code></td><td>One or more link UIDs to disconnect.</td></tr><tr><td><code>-f</code>, <code>--force</code></td><td>Skip confirmation prompt.</td></tr></tbody></table>

**Example**:

{% code expandable="true" %}

```bash
My Vault > epm-collection disconnect abc123uid --link agent-uid-1
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
public async Task<ModifyStatus> SetCollectionLinks(
    IEnumerable<CollectionLink> setLinks = null,
    IEnumerable<CollectionLink> unsetLinks = null)
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Disconnect-KeeperEpmCollection`&#x20;

**Alias**: `kepm-collection-disconnect`&#x20;

**Parameters**:

<table><thead><tr><th width="271">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionUidOrName</code></td><td>Collection UID or name (case-insensitive).</td></tr><tr><td><code>-LinkUid</code></td><td>One or more link UIDs to disconnect.</td></tr><tr><td><code>-Force</code></td><td>Skip confirmation prompt.</td></tr></tbody></table>

**Examples**:

{% code expandable="true" %}

```ps1
PS > Disconnect-KeeperEpmCollection Xgnlz6kDlNfdf8PlgV30ow -LinkUid "ah5j2UEjjDP5Y8oXdNaw3A"          
      
Confirm
Are you sure you want to perform this action?
Performing the operation "Disconnect" on target "1 link(s) from collection 'Xgnlz6kDlNfdf8PlgV30ow'".   
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
1 link(s) disconnected.
  Removed: Xgnlz6kDlNfdf8PlgV30ow
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection disconnect <links> [links...]`

**Aliases:** `pedm c disconnect`

**Flags:**

| Flag               | Description                                     |
| ------------------ | ----------------------------------------------- |
| `-c, --collection` | Parent collection UID or name (required)        |
| `-f, --force`      | Do not prompt for confirmation                  |
| `links`            | UIDs to unlink (required, can specify multiple) |

**Example:**

```
My Vault> pedm collection disconnect agent_abc123 --collection coll_servers --force

Links removed successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin, admin_types

plugin = admin_plugin.PedmPlugin(enterprise_loader)

collection_id = 'collection name or uid'
collection = plugin.collections.get_entity(collection_id)

existing_links= list(x for x in plugin.storage.collection_links.get_links_by_subject(collection.collection_uid))
links: Any = ['UIDs to unlink']
to_unlink: Set[str] = set(links)

to_remove: List[admin_types.CollectionLink] = []
for link in existing_links:
    link_uid = link.link_uid
    if link_uid in to_unlink:
        to_remove.append(admin_types.CollectionLink(
            collection_uid=collection.collection_uid,
            link_uid=link_uid,
            link_type=link.link_type)
        )

status = plugin.set_collection_links(unset_links=to_remove)
```

</details>

### Collection Wipe Out Command

Remove all collections of a specified type from the system. This command is useful for bulk cleanup operations but should be used with caution as it permanently deletes multiple collections.

<details>

<summary>DotNet CLI</summary>

**Command:** `epm-collection wipe-out`&#x20;

**Parameters**:

<table><thead><tr><th width="189.00006103515625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>--type</code></td><td>Collection type to wipe (1=OS Build, 2=Application, 3=User Account, 4=Group Account, 202=OS Version).</td></tr></tbody></table>

**Collection Types Reference:**

| Value | Name          |
| ----- | ------------- |
| 1     | OS Build      |
| 2     | Application   |
| 3     | User Account  |
| 4     | Group Account |
| 202   | OS Version    |

**Example**:

{% code expandable="true" %}

```bash
My Vault > epm-collection wipe-out --type 2
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

{% code expandable="true" %}

```csharp
// 1. Get all collection UIDs of the target type
var collectionUids = plugin.Collections.GetAll()
    .Where(c => c.CollectionType == targetCollectionType)
    .Select(c => c.CollectionUid)
    .ToList();

if (collectionUids.Count == 0)
{
    Console.WriteLine("No collections found for this type.");
    return;
}

// 2. Remove them all via ModifyCollections
ModifyStatus status = await plugin.ModifyCollections(
    addCollections: null,
    updateCollections: null,
    removeCollections: collectionUids);

// 3. Sync to refresh local state
await plugin.SyncDown();
```

{% endcode %}

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Remove-KeeperEpmCollectionsByType`&#x20;

**Alias**: `kepm-collection-wipeout`

**Parameters**:

<table><thead><tr><th width="250.99993896484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>-CollectionType</code></td><td>Collection type to wipe (1=OS Build, 2=Application, 3=User Account, 4=Group Account, 202=OS Version).</td></tr><tr><td><code>-Force</code></td><td>Skip confirmation prompt.</td></tr></tbody></table>

**Example**:

{% code expandable="true" %}

```ps1
PS > Remove-KeeperEpmCollectionsByType 1003

Confirm
Are you sure you want to perform this action?
Performing the operation "Delete" on target "1 Type 1003 collection(s)".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
1 collection(s) removed.
  Removed: gdaQx6wOVGrZharzghi_iA
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm collection wipe-out`

**Aliases:** `pedm c wipe-out`

**Flags:**

| Flag     | Description                           |
| -------- | ------------------------------------- |
| `--type` | Collection type to wipe out (integer) |

**Example:**

```
My Vault> pedm collection wipe-out --type 102

All collections of type 102 deleted
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**

```python
from keepersdk.plugins.pedm import admin_plugin, admin_types

plugin = admin_plugin.PedmPlugin(enterprise_loader)

collection_type = 10 #collection type upto 100
if isinstance(collection_type, int):
    collection_type = [collection_type]
collections: List[str] = []
for coll in plugin.storage.collections.get_all_entities():
    if collection_type and coll.collection_type not in collection_type:
        continue
    collections.append(coll.collection_uid)

plugin.modify_collections(remove_collections=collections)
```

</details>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/commander-sdk/keeper-commander-sdks/sdk-command-reference/pedm-commands/pedm-collection-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
