Custom Inventory WMI Win32_NetworkConnection not work
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
Comments
Hi Maybe it's because the
Hi
Maybe it's because the field for "Persistent" is type String in your CustomClass. Did you already try it as "boolean"?
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394220(v=vs.85).aspx
Cheers
Patrick
thank's for your answer
But it's the same e.g. when only the RemoteName is select and would be insert in his own Custom DataClass.
Regards,
Norbert
solved
enable the Run As Option to execute the Script with the "current logon user" and disable to lauch as 64-bit process
Regards,
Norbert
Would you like to reply?
Login or Register to post your comment.