Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Custom Inventory parsing text file NS7 - Need help

Created: 27 Jun 2011 | 4 comments
ArturoDFW's picture
0 0 Votes
Login to vote

Hello,

I am trying to create a custom inventory that will read a text file and would like to be able to import the results to a custom data class, By any chance do you guys have something that could share? 

I am struggling formatting it for NS7.

 Here is my vbscript:

 Option Explicit
 Dim oFSO, sFile, oFile, sText
 Set oFSO = CreateObject("Scripting.FileSystemObject")
 sFile = "c:\log.txt"
 If oFSO.FileExists(sFile) Then
  Set oFile = oFSO.OpenTextFile(sFile, 1)
   Do While Not oFile.AtEndOfStream
    sText = oFile.ReadLine
     If Trim(sText) <> "" Then
      WScript.Echo sText
     End If
   Loop
  oFile.Close
 'Else
  'WScript.Echo "The file was not there."
 End If

This scrip will give the information I need. Text file contents:

Querying active state...

TCP Global Parameters
----------------------------------------------
Receive-Side Scaling State          : enabled
Chimney Offload State               : automatic
NetDMA State                        : enabled
Direct Cache Acess (DCA)            : disabled
Receive Window Auto-Tuning Level    : normal
Add-On Congestion Control Provider  : none
ECN Capability                      : disabled
RFC 1323 Timestamps                 : disabled
** The above autotuninglevel setting is the result of Windows Scaling heuristics
overriding any local/policy configuration on at least one profile.

 

Thank you in advance,

Art

Comments

TGiles's picture
27
Jun
2011
0 Votes 0
Login to vote

Have you taken a look at our

Have you taken a look at our Knowledge Base article that contains an overview and samples for setting up custom inventory?

http://www.symantec.com/docs/howto9148

ArturoDFW's picture
27
Jun
2011
0 Votes 0
Login to vote

Yes, I have but I was not

Yes, I have but I was not able to format it to insert the results into my custom data class.

Rhys Paterson's picture
27
Jun
2011
0 Votes 0
Login to vote

You will need to create a data class with columns for each item.

(This is NS7)

Settings -> Discovery and Inventory -> Inventory Solution -> Manage Custom Data Classes

Click New Data Class and name it.

Then create 8 attributes - which are basically the columns in the new table.

Each of the 8 attributes would reflect the state of each of the settings you capture in your script:

 

Receive-Side Scaling State
Chimney Offload State
NetDMA State
Direct Cache Acess (DCA)
Receive Window Auto-Tuning Level
Add-On Congestion Control Provider
ECN Capability
RFC 1323 Timestamps
 
Give them a relevant data type such as string or boolean. Once that's done you just send that information into the table via a custom inventory script such as:
 
 ' **********************************

' Insert your script here.

' **********************************


' You will need to return 8 variables, one for each of the parameters you are storing

' IE:

' strReceiveSideScalingState

' strChimneyOffloadState

' strNetDMAState

' strDirectCacheAcess

' strReceiveWindowAutoTuningLevel

' strAddOnCongestionControlProvider

' strECNCapability

' strRFC1323Timestamps


' Create instance of Altiris NSE component and set the header data of the NSE

' The Altiris.AeXNSEvent class is installed with the inventory plugin and can be referenced externally. 


Dim NSE

Set NSE = WScript.CreateObject ("Altiris.AeXNSEvent")


' Please don't modify this GUID. This is the 'Inventory Capture Item'. 


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

NSE.Priority = 1


' Create Inventory data block for this dataclass. 

' Specify either the name or the guid of the associated dataclass.


Dim objDCInstance

Set objDCInstance = NSE.AddDataClass ("{YOUR NEW DATA CLASS GUID}")

Dim objDataClass

Set objDataClass = NSE.AddDataBlock (objDCInstance)


' Add a new row and set column values


Dim objDataRow

Set objDataRow = objDataClass.AddRow

objDataRow.SetField 0, strReceiveSideScalingState

objDataRow.SetField 1, strChimneyOffloadState

objDataRow.SetField 2, strNetDMAState

objDataRow.SetField 3, strDirectCacheAcess

objDataRow.SetField 4, strReceiveWindowAutoTuningLevel

objDataRow.SetField 5, strAddOnCongestionControlProvider

objDataRow.SetField 6, strECNCapability

objDataRow.SetField 7, strRFC1323Timestamps


' Send it off!


NSE.SendQueued


Set NSE = Nothing

Set objDCInstance = Nothing

Set objDataClass = Nothing

Set objDataRow = Nothing 
ArturoDFW's picture
28
Jun
2011
0 Votes 0
Login to vote

I will test this right now,

I will test this right now, thank you very much for your help. I will keep you posted.