Skip to content

$cs.CustomInventory_GetCategoryNames

CapaOne

Returns the names of the custom inventory categories on the device. Returns an empty array if there are none. Takes no parameters. Windows-only.

For how custom inventory is stored in categories, instances and values, see $cs.CustomInventory_SetValue.

$cs.CustomInventory_GetCategoryNames()

None.

Array of category names (string[]). Empty array if the device has no custom inventory.

Terminal window
$categories = $cs.CustomInventory_GetCategoryNames()
$cs.Job_WriteLog("Custom inventory categories: $($categories -join ', ')")

Logging the instances of every category:

Terminal window
foreach ($category in $cs.CustomInventory_GetCategoryNames()) {
$instances = $cs.CustomInventory_GetInstanceNames($category)
$cs.Job_WriteLog("$category has $($instances.Count) instances: $($instances -join ', ')")
}

$cs.CustomInventory_GetCategory $cs.CustomInventory_GetInstanceNames $cs.CustomInventory_RemoveCategory