We have a custom inventory VBScript below that doesn't always produce an output NSE.
Does anyone know of a way to invoke the old NS6 \cleanbeforerun option, or equivalent, for custom inventory scripts of this type?
'Custom inventory to read the BSkyB build version from the registry
'===================================================================================================================
' On Error Resume Next
'Create instance of Wbem service object and connect to namespace
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'Registry key path and values
strKeyPath = "SOFTWARE\NNNN"
strValueName1 = "OSP Build Version"
strValueName2 = "NNNN Build Version"
'Try to read the first value from the registry. If that returns nothing, try the second one.
oReg.GetStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName1,strValue
if isnull(strValue) Then
oReg.GetStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName2,strValue
end if
'===================================================================================================================
'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 ("{c0306711-a386-5e8b-5a39-65d10a149b7c}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
if not isnull(strValue) then
'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, strValue
end if
nse.SendQueued