Using Custom Inventory with Inventory Solution 7.0

Article:DOC1774  |  Created: 2009-03-06  |  Updated: 2009-03-06  |  Article URL http://www.symantec.com/docs/DOC1774
Article Type
Documentation


Description



Using Custom Inventory with Inventory Solution 7.0

Custom Inventory Methods

NSE creation interfaces

How to use the Custom Inventory from Inventory Solution for Windows 6.1 SP2 with Inventory Solution 7.0

Custom Inventory Methods

Inventory Solution 7.0 provides you two methods to perform custom inventory. You can use either method depending on your situation.

1.    The new 7.0 method: You can write the logic to gather custom inventory using VB script, Java script, Power script, Shell script, and so on, and roll it out the managed computers as tasks. This method frees you from the overhead of developing the custom inventory logic using the cryptic XML scripting style used by the Custom Inventory Agent in 6.x and allows you to use the power of all the available scripting languages.

See "About gathering custom inventory" in the Inventory Solution User's Guide.
See NSE creation interfaces below.

2.     The 6.x method: If you had developed the custom inventory scripts to run with Inventory Solution 6.x, you can continue using those with Inventory Solution 7.0. Please see How to use the Custom Inventory from Inventory Solution for Windows 6.1 SP2 with Inventory Solution 7.0 below.

NSE creation interfaces

You store gathered custom inventory in an NSE (Notification Server Event) and send the NSE to the Notification Server to be stored in the CMDB. The NSE must be in a specific XML format so that it can be processed correctly. The NSE interfaces help you format the XML code and send it correctly. See "About gathering custom inventory" in the Inventory Solution User's Guide.

The following is a simple example. The portions in yellow do not need to be modified. The portions in green represents the logic that you need to provide. This logic gathers the inventory. In the following example, the values are gathered from WMI.

'========================================================================================

'The following is a sample custom inventory script gathering information about the
processor of a computer and posting data to the server using Altiris NSE Component

'========================================================================================

' On Error Resume Next
 
'Create instance of Wbem service object and connect to namespace
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
'Fire WMI Query
Set objCIMObj = objWMIService.ExecQuery("select * from CIM_processor")


'========================================================================================
'Create instance of Altiris NSE component
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
 
' Set the header data of the NSE
' Please don't modify this GUID
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1
 
'Create Inventory data block. Here, the assumption is that the data class with
below guid is already configured on server
dim objDCInstance
set objDCInstance = nse.AddDataClass ("{
e8220123-4987-4b5e-bc39-
ec6eaea312ef
}")

dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)

For each objInfo in objCIMObj

'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0,
objInfo.DeviceID
objDataRow.SetField 1,
objInfo.L2CacheSize
objDataRow.SetField 2,
objInfo.L2CacheSpeed
Next

nse.SendQueued

'========================================================================================

The above script divides the process into four steps:

1. Gather the desired values:


strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

'Fire WMI Query
Set objCIMObj = objWMIService.ExecQuery("select * from CIM_processor")


2. Create NSE objects for the custom data class GUID:
 
'Create instance of Altiris NSE component
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")

' Set the header data of the NSE
' Please don't modify the following GUID.
It defines what receives and processes the NSE on server.
The priority value defines the priority in which the NSE
should be processed. Always keep it 1.

nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1

'Create Inventory data block. Here, the assumption is that
the data class with the below guid is already configured on
server. This creates a data class with the specified GUID.
The GUID used here can be obtained from Manage Custom
Dataclasses page > select a required data class and
click the details symbol.

dim objDCInstance
set objDCInstance = nse.AddDataClass ("{e8220123-4987-4b5e-bc39- ec6eaea312ef}")

' Add the datablock so that rows can be added to the data class.
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance
)

3. Store the gathered values into the NSE objects:

For each objInfo in objCIMObj

'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow


'Set columns
objDataRow.SetField 0,
objInfo.DeviceID
objDataRow.SetField 1, objInfo.L2CacheSize
objDataRow.SetField 2, objInfo.L2CacheSpeed
Next

4. Send the NSE:

nse.SendQueued

How to use the Custom Inventory from Inventory Solution for Windows 6.1 SP2 with Inventory Solution 7.0

A.    Terms:

Web inventory packages provided by Inventory Solution for Windows 6.x were used for inventorying unmanaged computers. In 7.0, these packages are called Stand-alone inventory packages. This document uses “stand-alone inventory packages” to refer to Web inventory packages from 6.x as well as standalone inventory packages of 7.0.

 

B.    Before you upgrade to NS 7:

1.     Back up all the custom inventory scripts that you use with Inventory Solution for Windows 6.1 SP2.

2.     Back up all the stand-alone inventory packages that you had created/customized for gathering the custom inventory.

3.     Back up all the ini files from NSCap\bin\Win32\X86and bin\Win32\X86\Inventory Solution that invokes the AeXCustInv.exe. These ini files are specified as a command line parameter to AeXInvSoln.exe on the “Go To Program” page->Command line” for the inventory tasks.

4.     Back up the NSCap\bin\Win32\X86\AeXPkgEditor.exe

 

 

C.    What will the upgrade do?

1.     The upgrade will migrate the custom dataclasses that you had created to NS 7.0 along with the inventory stored in those.

2.     The upgrade will remove the any custom inventory scripts at InstallDir\Altiris\Notification Server\NSCap\bin\Win32\X86 and at InstallDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory Solution  

3.     If you had created any task to gather the standard inventory as well as the custom inventory, the upgrade will create task to gather the equivalent standard inventory, but not the custom inventory. You will manually need to create a task to gather the custom inventory as described further in this document.

4.     The upgrade will install a folder installDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1which contains the new agent for custom inventory. This agent consists of following files:

a.     AeXInvSoln.exe – Same file as that was provided in 6.1 SP2. This Launches AeXCustInv.exe and AeXNSInvCollector.exe as specified in AeXInvSoln.ini.

b.    AeXCustInv.exe – This is a different file than that was provided in 6.1 SP2. It behaves in the similar way that it used to in 6.1 SP2, but have few bugs fixed.

c.     AeXNSInvCollector.exe – This is a different file than that was provided in 6.1 SP2. This behaves similar way that it used to in 6.1 SP2 but with the only difference that now it generates the NSEs in the new format that is required for posting inventory to NS 7.0.

d.    AeXNSEvent.dll – This is a new file, it was not present in 6.1 SP2. AeXNSInvCollector.exe uses this file for generating the NSEs in new format.

e.     AeXInvSoln.ini – Specifies an example of how to launch the AeXCustInv.exe and AeXNSInvCollector.exe

f.     AeXCustInvStd.cit – Sample custom inventory script from 6.1 SP2.

 

D.    How to create a new stand-alone inventory package to gather custom inventory?

1.     Make a copy of an existing Stand-alone inventory package which you had backed up before upgrade.

2.     Right click the copy of the package file and rename it to the new package name.

3.     Open it using AeXPkgEditor.exe from 6.x.

4.     Go to files tab, delete all the files, except AeXIsHttp.ini (or the equivalent ini file) and the custom scripts/utilities.

5.     Extract AeXIsHttp.ini.

6.     Edit AeXIsHttp.ini to launch AeXCustInv.exe and AeXNSInvCollector.exe.

7.     If you use /url command line switch to AeXNSInvCollector.exe for posting the NSEs on HTTP or Secured HTTP URL, for example: http://NSName/aexns/postevent.asp. Please modify the URL to use http://NSName/Altiris/NS/Agent/PostEvent.asp

8.     Add AeXIsHttp.ini to the package.

9.     Add AeXInvSoln.exe, AeXCustInv.exe, AeXNSInvCollector.exe, and AeXNSEvent.dll from installDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1 to the package.

10.  Go to the Options tab, edit the command line, if you have renamed AeXIsHttp.ini or want to use an ini file other than AeXIsHttp.ini. Customize the other options as required.

11.  Save the package.

12.  Distribute it to the targets.

 

Note for steps 4 and 6: The NSIs generated by the Machine inventory agent, Software scan agent, Serial number agent, Exchange inventory agent from 6.1 will not be acceptable by NS 7.0, because the schema of the dataclasses reported by these agents have changed altogether from 6.1 SP2 to 7. If your custom inventory scripts, read the NSIs generated by these agents to extract particular values and include those in to custom inventory NSI, you can keep the required agents in the stand-alone inventory package and the corresponding command lines in the AeXIsHttp.ini

 

E.    How to modify an existing stand-alone inventory package to gather custom inventory?

1.     Back up the stand-alone inventory package to revert back in case needed.

2.     Open it using AeXPkgEditor.exe from 6.x.

3.     Go to files tab, delete all the files, except AeXIsHttp.ini (or the equivalent ini file) and the custom scripts

4.     Extract AeXIsHttp.ini.

5.     Edit AeXIsHttp.ini to launch AeXCustInv.exe and AeXNSInvCollector.exe.

6.     If you use /url command line switch to AeXNSInvCollector.exe for posting the NSEs on HTTP or Secured HTTP URL, for example: http://NSName/aexns/postevent.asp. Please modify the URL to use http://NSName/Altiris/NS/Agent/PostEvent.asp.

7.     Add AeXIsHttp.ini to the package.

8.     Add AeXInvSoln.exe, AeXCustInv.exe, AeXNSInvCollector.exe, and AeXNSEvent.dll from installDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1 to the package.

9.     Go to the Options tab, edit the command line, if you have renamed AeXIsHttp.ini or want to use an ini file other than AeXIsHttp.ini. Customize the other options as required.

10.  Save the package.

11.  Distribute it to the targets.

 

F.    How to create a task to run on managed computers?

1.     Copy all the custom inventory scripts/utilities at installDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1

2.     Create InvSoln.ini to launch AeXCustInv.exe and AeXNSInvCollector.exe.

3.     If you use /url command line switch to AeXNSInvCollector.exe for posting the NSEs on HTTP or Secured HTTP URL, for example: http://NSName/aexns/postevent.asp. Please modify the URL to use http://NSName/Altiris/NS/Agent/PostEvent.asp.

4.     Save the ini file at installDir\Altiris\Notification Server\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1

5.     Open Symantec Management Console.

6.     Go to Manage>Software.

7.     Expand Software.

8.     Click on Software Catalog.

9.     In the right pane, click on Import,

10.  On the Import Software: Specify Software page,

1.     select Software type = Software Release.

2.     In Package source, select Source=Access Package from an existing UNC.

3.     Set Location to the UNC path to Custom Inventory 6.1 folder by browsing to it. For example: \\NSServer\NSCap\bin\Win32\X86\Inventory\Custom Inventory 6.1

4.     In Package contents, click Display Location. This will enlist all the files in the Custom Inventory 6.1folder.

5.     Select AeXInvSoln.exe and click Set Installation File

6.     Click Next.

7.     On the next page, Import Software: Software Details,  change the Name to Custom Inventory. Enter the Description. Select Open software resource for editing when finished.

8.     Click OK.

9.     On the next page, go to Package tab.

10.  In Command Lines section, select Install and click Edit.

11.  On the Add or Edit Command Line page

1.     Change the Name to “Custom inventory”

2.     Change the Description to “Runs custom inventory”

3.     Set the Command line as you want the AeXInvSoln.exe should be invoked, or as it was specified in 6.1 SP2 at  Go To Program page->Command line for the inventory tasks. For example: AeXInvSoln.exe /cleanbeforerun /hidden /s InvSoln.ini.

Here the InvSoln.ini is the ini file was created in step 2.

4.     Define Success codes  as 0.

5.     Define Failure Codes as 1.

6.     Click OK.

12.  Click Save changes and close the window.

11.  Install and configure the Software Management Solution on NS.

12.  Install the Software Management Solution Agent on the target computers where you want to run the custom inventory.

13.  Go to Manage->Jobs and Tasks.

14.  In the left pane select Software->Quick Delivery.

15.  In the right pane click Add.

16.  On Create new task page, enter the Name and Description.

17.  In Software Settings section, set Software resource to Custom Inventory from the drop down list. Custom Inventory is the software resource you created in step 10.

18.  Click OK. This will take you to the Quick Delivery page.

19.  Select the Quick Delivery task and schedule it.

 

G.    How to run the custom inventory 6.1 immediately followed by standard inventory in 7.0?

On managed computers:

1.     Create inventory task for gathering the inventory of dataclasses that you want.

2.     Create custom inventory Quick Delivery task as described in the above step E.

3.     Go to Manage->Jobs and Tasks.

4.     On Create New Task page, in the left pane select Client Job.

5.     In the right pane, enter the job’s name.

6.     Select Add Existing and add the tasks that you have created in step 1 and 2.

7.     Sequence the tasks as you want. Remember, if there is a dataclass is which is populated by Inventory as well as custom inventory, the last one out of the tasks which would populate the dataclass, may overwrite the contents of dataclass populated by the one which ran earlier in the job.

8.     Define failure criteria, as required.

9.     Click OK.

10.  Schedule the job on the client computers.

On unmanaged computers:

1.     Create a stand-alone inventory package to gather the dataclasses that you want, using Symantec Management Console -> Settings -> All Settings -> Discovery and Inventory -> Inventory Solution -> Stand-alone Inventory Packages.

2.     Create a stand-alone inventory package for gathering custom inventory as described in steps C and D.

3.     Create batch file (*.bat) to launch these two stand-alone inventory packages in the sequence that you want. Remember, if there is a dataclass is which is populated by Inventory as well as custom inventory, the last one out of the packages which would populate the dataclass, may overwrite the contents of dataclass populated by the one which ran earlier. 4.     You can make these three components available to the target computers and request the users to run the batch file.

5.     Or, you can create a stand-alone package as described in D using AeXPkgEditor.exe. Go to Files tab and add the stand-alone packages and the batch file.  Go to Options tab and set Command line to run the batch file. Save the package. Make the package available to the target computers and request users on the target computers to run the package.

 

H.    How to create a new dataclass for storing custom inventory?

If you want to store the custom inventory in a dataclass apart from the standard dataclasses provided by Inventory Solution or the dataclasses that you had created in 6.x, you can create a new dataclass using Symantec Management Console -> Settings -> All Settings -> Discovery and Inventory -> Inventory Solution ->Manage Custom Data classes. 



Legacy ID



45963


Article URL http://www.symantec.com/docs/DOC1774


Terms of use for this information are found in Legal Notices