Video Screencast Help

Can you invoke the NS6 'cleanbeforerun' option on a custom NS7 inventory VbScript

Created: 20 Dec 2012 | 1 comment

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 _
if isnull(strValue) Then
 oReg.GetStringValue _
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


Comments 1 CommentJump to latest comment

andykn101's picture

If you delete the .nsi and/or .bak file for that data class in the script first, that should have the same effect.

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.