# $cs.CustomInventory_RemoveCategory

> Removes a custom inventory category with all its instances and values. Does nothing if the category doesn't exist.

Source: https://docs.capaone.com/capainstaller/powerpacks/cs-custominventory-removecategory/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

**CapaOne**

### Description

Removes a custom inventory category with all its instances and values. Does nothing if the category doesn't exist. Windows-only.

For how custom inventory is stored in categories, instances and values, see [$cs.CustomInventory_SetValue](/capainstaller/powerpacks/cs-custominventory-setvalue/).

:::note[Collected only by CapaOne]
The function works on any Windows device, also under CapaInstaller, and removes the data from the registry under `HKLM\SOFTWARE\CapaSystems\CapaOneAgent\CustomInventory`. Only the CapaOne agent collects that data, so the removal reaches CapaOne with the agent's next hardware inventory. On a device without the CapaOne agent, only the registry changes.
:::

### Syntax

$cs.CustomInventory_RemoveCategory(string category)

### Parameters

#### category (String)

Name of the category to remove, for example `Installed Applications`. Names aren't case-sensitive. Can't be empty or longer than 255 characters, and can only contain letters, digits, spaces and `-`: see [Names](/capainstaller/powerpacks/cs-custominventory-setvalue/#names).

### Return value

None. Throws an error if `category` isn't valid.

### Example

**PowerShell**

Removing the category that the package's install script wrote, during `Uninstall`:

```powershell
$cs.CustomInventory_RemoveCategory('Contoso AppSuite')
```

Removing a category that no package writes any more, if it exists:

```powershell
if ($cs.CustomInventory_GetCategoryNames() -contains 'Office Location') {
    $cs.CustomInventory_RemoveCategory('Office Location')
    $cs.Job_WriteLog("Removed the old 'Office Location' custom inventory")
}
```

### Related functions

[$cs.CustomInventory_RemoveInstance](/capainstaller/powerpacks/cs-custominventory-removeinstance/) [$cs.CustomInventory_RemoveValue](/capainstaller/powerpacks/cs-custominventory-removevalue/) [$cs.CustomInventory_GetCategoryNames](/capainstaller/powerpacks/cs-custominventory-getcategorynames/)
