CMS_AddCustomInventory
Description
Adds a persistent CustomInventory row to the database, meaning that the data will not be flushed out the next time that the CustomInventory package is run.
Â
Please note
Please note, that this is an expensive call, seen from the Frontend/database perspective. Calling this function repeatedly from a package could result in overall slower performance. This function should be used with care.Â
Syntax
CMS_AddCustomInventory(category, entry, value, valuetype)
[bool]CMS_AddCustomInventory -category <string> -entry <string> -value <string> -valuetype <string>
Parameters
category (String)
Category name
entry (String)
variable name
value (string)
value (string)
If you are inserting a Time (valuetype: "T") it must be set in epoch-time, meaning seconds since January 1. 1970. The scripting library has a function called GetEpochTime, which will convert a date to seconds from 1-1-1970.
If you want to use 'now' as the value, you can either insert;
an empty string ("")
or the value ("0")
valuetype (string)
The type of the value
Valid valuetypes are;
"S" for string
"I" for integer
"T" for time
Return value
Boolean, TRUE if function completed successfully.
Boolean, TRUE if function completed successfully.Â
Example
VBScript
If bStatus Then bStatus = CMS_AddCustomInventory("Customer Inventory", "Install time packages", "112", "I")
If bStatus Then bStatus = CMS_AddCustomInventory("Bitlocker", "TPM Chip - Enabled", "True", "S")
If bStatus Then bStatus = CMS_AddCustomInventory("Bitlocker", "TPM Chip - Manufactured", "1694973146", "T")
PowerShell
CMS_AddCustomInventory 'Customer Inventory' 'Install time packages' '112' 'I'
CMS_AddCustomInventory -category 'Bitlocker' -entry 'TPM Chip - Enabled' -value 'True' -valuetype 'S'
if (CMS_AddCustomInventory('Bitlocker' 'TPM Chip - Manufactured' '1694973146' 'T') {
$cs.Job_WriteLog("Added", "Bitlocker entry added to Custom inventory")
}