Collect custom VBS scripts via standalone inventory package for Inventory Solution
search cancel

Collect custom VBS scripts via standalone inventory package for Inventory Solution

book

Article ID: 279823

calendar_today

Updated On: 02-04-2025

Products

Inventory Solution

Issue/Introduction

Standard standalone inventory package does not collect information for custom dataclasses.

Environment

ITMS 8.7 and older

Cause

Product limitation

Resolution

1. Create custom dataclass to store required data.
This may be done using Manage Custom Data Classes page (Settings > Discovery and Inventory > Inventory
Solution > Manage Custom Data Classes):

a. Click New data class and define data class name

b. Define data class scheme (add data class attributes aka columns)

c. Save changes.
d. Select created data class from the list and note its name and guid

2. Create XML file containing data class definition, VB Script and mapping script output with data class columns.
Separate file should be created for each custom data class. Format of file is the following:

<dataClass name="Custom Dataclass 1" GUID="{d23111f2-b72c-46bd-af16-8c83bb7bd7d1}">

 <approaches>

  <approach type="script">

   <commands>

    <command scriptType="vbscript" function="execute" timeout="2400000">

     <scriptText>

      <![CDATA[

     Function execute()

     Set resultset = CreateObject("Scripting.Dictionary")

     x = 0

     do

     Set rowDictionary=CreateObject("Scripting.Dictionary")

     rowDictionary.Add "c0", "field" & x & "1"

     rowDictionary.Add "c1", x

     rowDictionary.Add "c2", "somefield" & x

     resultset.add resultset.Count, rowDictionary

     x = x+1

     Loop while x < 3

     execute = SymInv_GetDataclassResults(resultset)

     End function

]]>

      </scriptText>

     <properties>

      <property mapsTo="0">value1</property>

       <property mapsTo="1">record number</property>

<property mapsTo="2">some text</property>

     </properties>

    </command>

   </commands>

  </approach>

 </approaches>

</dataClass>

Highlighted part is subject to be changed. Remaking parts are mandatory and should not be modified:
- Define data class name and GUID. Values should match values from step 1d.
- Modify content Function execute() so that it returns string like ‘&lt;row c0=”field01” c1=”filed02”\&gt; &lt;row c0=”field11”
c1=”filed12”\&gt; &lt;row c0=”field21” c1=”filed22”\&gt;’. We recommend to use predefined function
SymInv_GetDataclassResults() – it returns correct string generating it from dictionary of output
values(see provided sample and Appendix A)
- Define mapping. It is required to define &lt;property mapsTo=&quot;0&quot;&gt;value1&lt;/property&gt; for each column
that need to be reported.
Value of attribute mapsTo corresponds to column index (for “c0” it is “0”, for “c1” it is ”1”, etc).
Value of node property is not used, so you may just put here some description or just set “value1” ,”value2”,
“value3”, etc..

3. Put all created prepared XML files to any specific folder on Notification Server
4. Create new registry string value “HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Inventory\StandaloneCustomScripts”
and set it to full path name to directory created in previous step

5. Create new Standalone Package from Stand-alone Inventory Packages page (Settings > Discovery and
Inventory > Inventory Solution > Stand-alone Inventory Packages)
When registry key StandaloneCustomScripts is defined, scripts located under specified folder will be embedded to
standalone package during package creation process, but it is required to select at least one pre-defined data
class for collection - it is not allowed to create package without any data classes selected in UI
Note: Altiris Log contains messages for each custom script, if format is invalid error is logged – search
informational message “Importing custom inventory scripts” to review logs
6. Execute created package on endpoints
7. Custom data classes created in step 1 will be populated with collected data.

 

 

Additional Information

KNOWN ISSUES:
* Only VBS scripts are supported
* Script must have Function execute() returning string like 

 ‘<row c0=”field01” c1=”filed02”\> <row c0=”field11” c1=”filed12”\> <row c0=”field21” c1=”filed22”\>’


* All values need to be XML escaped
* Standalone package cannot include only custom scripts, at least one predefined data class should be selected for collection as
well