$cs.CustomInventory_GetInstance
Description
Section titled “Description”Returns all values of a custom inventory instance, by name. Returns $null if the instance or 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_GetInstance(string category, string instance)
Parameters
Section titled “Parameters”category (String)
Section titled “category (String)”Name of the category, for example Office. Names aren’t case-sensitive. Can’t be empty or longer than 255 characters, and can only contain letters, digits, spaces and -: see Names.
instance (String)
Section titled “instance (String)”Name of the instance in the category. Pass "" for the instance default, which a category with only one instance uses. Same rules as category.
Return value
Section titled “Return value”Ordered dictionary (System.Collections.Specialized.OrderedDictionary) of value name to value, including Last Updated. Each value is returned without its unit, as $cs.CustomInventory_GetValue returns it. Value names aren’t case-sensitive.
$null if the instance or the category doesn’t exist. Throws an error if an argument isn’t valid, for example an empty category.
Example
Section titled “Example”$office = $cs.CustomInventory_GetInstance('Office', '')if ($null -ne $office) { $cs.Job_WriteLog("Office: $($office['City']), floor $($office['Floor'])")}Logging every value of an instance:
$values = $cs.CustomInventory_GetInstance('Installed Applications', '7-Zip')foreach ($entry in $values.GetEnumerator()) { $cs.Job_WriteLog("$($entry.Key) = $($entry.Value)")}Related functions
Section titled “Related functions”$cs.CustomInventory_GetValue $cs.CustomInventory_GetInstanceNames $cs.CustomInventory_GetCategory $cs.CustomInventory_RemoveInstance