Have anybody successfull create an custom vbscript inventory in NS7 witch list the connected network connection from an computer?
I have all steps done like in the "Custom Inventory for ITMS 7.1" technical whitepaper.
When it runs in a local command box it works fine but not when it runs with an inventory task.
Then the script crash in Line 'For each objInfo in colRunningServices' and no data was send to CMDB.
When i manually set the values in the script(like Name = "test" and whithout "For Each" loop) , the values successfully send to the CMDB.
Please help.
Thank you.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("select * from Win32_NetworkConnection")
'============================================
'Create instance of Altiris NSE component
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1
dim objDCInstance
'my custom data class
set objDCInstance = nse.AddDataClass ("{84dd47bd-027b-4017-a0a5-63654ce9c083}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
For each objInfo in colRunningServices 'script crash here because invalid data
dim objDataRow
set objDataRow = objDataClass.AddRow
objDataRow.SetField 0, objInfo.Name
objDataRow.SetField 1, objInfo.RemoteName
objDataRow.SetField 2, objInfo.LocalName
objDataRow.SetField 3, objInfo.Status
objDataRow.SetField 4, objInfo.Username
objDataRow.SetField 5, objInfo.ProviderName
objDataRow.SetField 6, objInfo.ResourceType
objDataRow.SetField 7, objInfo.Persistent
Next
nse.SendQueued