Client Management Suite

 View Only
  • 1.  Custom inventory script

    Posted May 24, 2023 11:54 AM

    I have a vb script to collect all items in the Control Panel. That part of the script works as I used it in  a script task with save output with task option.  I have created the custom data table and used its guid in the script to write the results to the database. However, the results gathered are not going into the table and I do not know why. Have compare against many other scripts I have and just can't figure out what is wrong. Following is the script:

    Const CONTROL_PANEL = &H3&

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(CONTROL_PANEL)
    Set objFolderItem = objFolder.Self
    ' Wscript.Echo objFolderItem.Path

    Set colItems = objFolder.Items
    For Each objItem in colItems
       Wscript.Echo objItem.Name

     NEXT

    '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 ("{f30eb5ef-dfe1-432f-823b-60aa4ca2e021}")

    dim objDataClass
    set objDataClass = nse.AddDataBlock (objDCInstance)
     

    For each objItem in objCIMObj
     'Add a new row
     dim objDataRow
     set objDataRow = objDataClass.AddRow
     'Set columns
    wscript.echo objItem.Name 
      objDataRow.SetField 0, objItem.Name
       
    Next

    nse.SendQueued

     



  • 2.  RE: Custom inventory script

    Broadcom Employee
    Posted May 25, 2023 12:58 AM

    Hi Stephen Jaeger!

    As far as I see, there should be colItems instead of objCIMobj




    Const CONTROL_PANEL = &H3&

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(CONTROL_PANEL)
    Set objFolderItem = objFolder.Self
    ' Wscript.Echo objFolderItem.Path

    Set colItems = objFolder.Items
    For Each objItem in colItems
       Wscript.Echo objItem.Name

    Next

    '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 ("{f30eb5ef-dfe1-432f-823b-60aa4ca2e021}")

    dim objDataClass
    set objDataClass = nse.AddDataBlock (objDCInstance)

    For each objItem in colItems
     'Add a new row
     dim objDataRow
     set objDataRow = objDataClass.AddRow
     'Set columns
    wscript.echo objItem.Name 
      objDataRow.SetField 0, objItem.Name

    Next

    nse.SendQueued



    Best regards,
    IP.