$cs.CustomInventory_GetCategoryNames
CapaOne
Terminal window Terminal window
Description
Section titled “Description”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.
Syntax
Section titled “Syntax”$cs.CustomInventory_GetCategoryNames()
Parameters
Section titled “Parameters”None.
Return value
Section titled “Return value”Array of category names (string[]). Empty array if the device has no custom inventory.
Example
Section titled “Example”$categories = $cs.CustomInventory_GetCategoryNames()$cs.Job_WriteLog("Custom inventory categories: $($categories -join ', ')")Logging the instances of every category:
foreach ($category in $cs.CustomInventory_GetCategoryNames()) { $instances = $cs.CustomInventory_GetInstanceNames($category) $cs.Job_WriteLog("$category has $($instances.Count) instances: $($instances -join ', ')")}Related functions
Section titled “Related functions”$cs.CustomInventory_GetCategory $cs.CustomInventory_GetInstanceNames $cs.CustomInventory_RemoveCategory