Searching...
Filters
SmallMediumLarge
Home Print Show Topic URL Previous Next
IT Management Suite
Client Management Suite
Server Management Suite
Deployment Solution
Asset Management Suite
ServiceDesk

Custom inventory sample script for Windows

ITMS 6.x Migration

The sample inventory script for Windows does the following:

  • Creates a WMI object, runs a WMI query, and stores the result set.

  • Creates a Notification Server event (NSE) object.

  • Creates an Inventory data block and associates it with a specific custom data class.

  • Loops through each row in the result set and populates each row of the result set into a row in the data block.

  • Processes and sends the NSE to Notification Server.

See Configuring the custom inventory sample script for Windows

'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 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