# $cs.CustomInventory_GetCategory

> Returns all instances of a custom inventory category with their values, as an ordered dictionary. Returns $null if the category doesn't exist.

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

**CapaOne**

### Description

Returns all instances of a custom inventory category with their values. Returns `$null` 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 reads the data in the registry under `HKLM\SOFTWARE\CapaSystems\CapaOneAgent\CustomInventory`. Only the CapaOne agent collects that data, with its hardware inventory. On a device without the CapaOne agent, the data stays in the registry.
:::

### Syntax

$cs.CustomInventory_GetCategory(string category)

### Parameters

#### category (String)

Name of the category, 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

Ordered dictionary (`System.Collections.Specialized.OrderedDictionary`) of instance name to the instance's values. The values of each instance are an ordered dictionary of value name to value, as [$cs.CustomInventory_GetInstance](/capainstaller/powerpacks/cs-custominventory-getinstance/) returns them.

`$null` if the category doesn't exist. Throws an error if `category` isn't valid.

### Example

**PowerShell**

```powershell
$applications = $cs.CustomInventory_GetCategory('Installed Applications')
if ($null -ne $applications) {
    foreach ($application in $applications.GetEnumerator()) {
        $cs.Job_WriteLog("$($application.Key): version $($application.Value['Version'])")
    }
}
```

### Related functions

[$cs.CustomInventory_GetCategoryNames](/capainstaller/powerpacks/cs-custominventory-getcategorynames/) [$cs.CustomInventory_GetInstance](/capainstaller/powerpacks/cs-custominventory-getinstance/) [$cs.CustomInventory_RemoveCategory](/capainstaller/powerpacks/cs-custominventory-removecategory/)
