Using Custom Inventory

To use a custom inventory file, you must create the custom inventory file in XML and distribute it to each agent.

To distribute a custom XML file, create an XML file named CustomInventory.xml, an then add it to a custom patch that you create using the Package Editor Wizard. The custom patch should install to the following file paths:

  • For Windows endpoints, <Program Files>\HEATSoftware\HEATAgent\live\patch\CustomInventory.xml
  • For Linux, Unix, or Mac endpoints, <installdir>/update/conf.d/custominventory.xml

For more information on creating a package, see Using the Package Editor.

Afterward, deploy the custom patch to your Patch endpoints. For more information, see Using the Deployment Wizard.

Guidelines for Linux/Unix/Mac-based Operating Systems

Using the syntax in this section, you can create custom inventory for Linux, Unix, or Mac-based operating systems.

The following section defines the valid XML guidelines for setting up custom inventory scripts for Linux/Unix/Mac based Operating Systems. In each case, the item will be added to the hardware inventory under the Default device class unless a specific device class (item class="") is defined.

Literal

Allows the user to assign an actual text value type into XML.

The string added will be of the form "name = value" where name is the tag name, and value is the literal typed between the open and close tags.

Example XML (This example will return the string value defined between the open and close tags):

Copy
<item class="User Defined" name="Example Name" type ="Literal">
    Ivanti 8.6 Custom Inventory
</item>

Returns:

  "Example Name = Ivanti 8.6 Custom Inventory"

Dynamic

Allows the user to search using a script.

The string added will be of the form "name =value" where name is the tag name, and value is the result of the script.

Example XML:

Copy
<item class="System" name="Ivanti Disk Usage" type="dynamic">
    <command>
        <!-- Define shell -->
        <shell>
            <![CDATA[/bin/sh]]>
        </shell>
        <!-- Define execution directory -->
        <dir>
            <![CDATA[/tmp]]>
        </dir>
        <envs>
            <env>
                <!-- Define the JAVA HOME environment variable -->
                <EnvName>
                    <![CDATA[JAVA HOME]]>
                </EnvName>
                <EnvValue>
                    <![CDATA[/usr/local]]>
                </EnvValue>
            </env>
        </envs>
        <!-- Script -->
        <content>
            <![CDATA[echo -n 'du -ks /usr/local/work/Ivanti \(in kb\)]]>
        </content>
    </command>
</item>

Returns:

  "Ivanti Disk Usage = 18.1 (in kb) "d

Guidelines for Microsoft Windows-based Operating Systems

Using the syntax in this section, you can create custom inventory for Windows-based operating systems.

The following section defines the XML guidelines for setting up custom inventory scripts for Windows- based operating systems. In each case, the item will be added to the hardware inventory under the default device class unless a specific device class (item class="") is defined.

Literal

Allows the user to assign an actual text value type into XML.

The string added will be of the form "name = value" where name is the tag name, and value is the literal typed between the open and close tags.

Example XML: (This example will return the string value defined between the open and close tags)

Copy
<item class="User Defined" name="Example Name" type="Literal">
    Ivanti 8.6 Custom Inventory
</item>

Returns:

  "Example Name = Ivanti 8.6 Custom Inventory"

Registry

Allows the user to retrieve the registry key value.

The string added will be of the form "name = value" where name is the tag name and value is the value stored under the identified registry key.

Example XML (This example will return, from the Registry, the location and name of the custom inventory file):

Copy
<item name="Registry Example" type="registry">
    HKEY_LOCAL_MACHINE\Software\PatchLink.com\DiscoveryAgent\InventoryInputFile
</item>

Returns:

  "Registry Example= C:\ProgramFiles\Ivanti\CustomInventory.xml"

Environment

Allows the user to return the value of an environment value.

The string added will be of the form "name = value" where name is the tag name and value is the expanded environment variable defined.

Example XML (This example will return the value of the defined environment variable):

Copy
<item name="Environment Example" Class="User Defined" type="Environment">
    %PROCESSOR_ARCHITECTURE%
</item>

Returns:

  "Environment Example = i386"

WMI

Windows Management Instrumentation (WMI) allows the user to use scripting to control the WMI component, and tends to focus on operating system settings.

In the case of a WMI item, two additional attributes, namespace and query are used. If the namespace attribute is not specified, the default value of ROOT\CIMV2 is used. The query attribute must be defined as a valid WQL query. The string added will be of the form "name = value" where name is the tag name and value is the actual value for the specified WMI property.

Example XML (This example will return the Serial Number property from the Operating System):

Copy
<item name="Windows SN" type="wmi" query=" SELECT * FROM Win32_OperatingSystem">
    SerialNumber
</item>

Returns:

  "Windows SN = ABCD-EFGH-IJKL"

Example XML (This example will retrieve the Manufacturer property of the device):

Copy
<item name="Device Manufacturer" type="wmi" query=" SELECT * FROM Win32_OperatingSystem">
    Manufacturer
</item>

Returns:

  "Device Manufacturer = Computer Manufacturer A

Text_File

Allows the user to retrieve text data from a file.

The string added will be of the form "name = value" where each line of the text file contains a Name/ Value pair separated with a delimiter (defined with the delimiter attribute). For each valid line, in the text file, an entry will be added to inventory. When specifying a file name an environment variable, such as %WINDIR% can be used.

Example XML (This example will return the Name/Value pairs from a TXTSample.txt file in the Windows directory):

Copy
<item name="ti" type="text_file" delimiter="=">
    %WINDIR%\TXTSample.txt
</item>

Returns:

  "Line 1 = This is line one" Line 2 = This is line two"

Each line item retrieved from the text file cannot exceed 200 characters. In the event that a line within a defined text file exceeds 200 characters, Ivanti recommends truncating the line item below the 200 character limit.

XML_File

Allows the user to retrieve text data from a file.

An external XML file will be referenced. The XML file structure must be defined by the XPath string. When specifying an XML file name an environment variable, such as %WINDIR% can be used.

Example XML (This example will return the value of the Asset Number tag from the SampleXML.xml file in the Windows directory):

Copy
<item name="Asset" type="xml_file" xpath="/Top/Inventory/AssetNumber">
    %WINDIR%\SampleXML.xml
</item>

Returns:

  "Asset = PLA001"

Example XML (This example will return the value of the Location tag from the SampleXML.xml file in the Windows directory):

Copy
<item name="Building" type="xml_file" xpath="/Top/Inventory/Location">
    %WINDIR%\SampleXML.xml
</item>

Returns:

  "Building = Scottsdale-Main"

Where the SampleXML.xml file is as follows:

Copy
<?xml version="1.0" encoding="utf-8"?>

<Top>
    <Inventory>
        <AssetNumber>PLA001</AssetNumber>
        <Location>Scottsdale-Main</Location>
    </Inventory>
</Top>

An example XML file, using the valid Windows agent inventory options, is provided below:

Copy
<?xml version="1.0" encoding="utf-8"?>

<customInventory>
    <items>
        <item name="l1" class="User Defined" type="literal">
            value1
        </item>
        <item name="r1"class="My New Class" type="registry">
            HKEY_LOCAL_MACHINE\Software\PatchLink.com\DiscoveryAgent\InventoryInputFile
        </item>
        <item name="e1" class="My New Class" type="environment">
            %PROCESSOR_ARCHITECTURE%
        </item>
        <item
            name="w1"
            class="My New Class"
            type="wmi"
            namespace="ROOT\CIMV2"
            query="SELECT * FROM Win32_OperatingSystem">
            SerialNumber
        </item>
        <item name="t1" class="My New Class" type="text_file" delimiter="=">
            c:\sampleInventoryText.txt
        </item>
        <item name="x1" class="My New Class" type="xml_file" xpath="//inventory/AssetTag">
            c:\sampleInventoryXML.xml
        </item>
    </items>
</customInventory>

Where the C:\SampleInventory.txt file is as follows:

  Building = MainLocation = Scottsdale, AZDivision = Corporate

And the C:\SampleInventoryXML.xml file is as follows:

Copy
<?xml version="1.0" encoding="utf-8"?>

    <inventory>
        <AssetTag>
            PLA00012
        </AssetTag>
    </inventory>