$cs.CustomInventory_RemoveCategory
Description
Section titled “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.
Syntax
Section titled “Syntax”$cs.CustomInventory_RemoveCategory(string category)
Parameters
Section titled “Parameters”category (String)
Section titled “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.
Return value
Section titled “Return value”None. Throws an error if category isn’t valid.
Example
Section titled “Example”Removing the category that the package’s install script wrote, during Uninstall:
$cs.CustomInventory_RemoveCategory('Contoso AppSuite')Removing a category that no package writes any more, if it exists:
if ($cs.CustomInventory_GetCategoryNames() -contains 'Office Location') { $cs.CustomInventory_RemoveCategory('Office Location') $cs.Job_WriteLog("Removed the old 'Office Location' custom inventory")}Related functions
Section titled “Related functions”$cs.CustomInventory_RemoveInstance $cs.CustomInventory_RemoveValue $cs.CustomInventory_GetCategoryNames