'-------------- 'Purpose: Recurse through specifically named registry keys for subkeys, and copy the ' relevant information from regkeys into 1 custom WMI class, for later ' retrieval using a Configuration Management sms_def.mof edit. 'Author: Sherry Kissinger, ConfigMgr MVP 'Date: 2/14/2011 'Version: 1.0 '-------------- 'Regkey locations obtained from Scott Baker, Autodesk EIS (scott.baker@autodesk.com), ' from a mof edit created February, 2010. '-------------- on error resume next DIM str1(25,5) str1(0,0)= "Software\Autodesk\3dsmax\9.0" str1(1,0)= "Software\Autodesk\Inventor" str1(2,0)= "Software\Autodesk\AutoCAD LT\R16" str1(3,0)= "Software\Autodesk\AutoCAD LT\R15" str1(4,0)= "Software\Autodesk\AutoCAD LT\R14" str1(5,0)= "Software\Autodesk\AutoCAD LT\R13" str1(6,0)= "Software\Autodesk\AutoCAD LT\R12" str1(7,0)= "Software\Autodesk\AutoCAD LT\R11" str1(8,0)= "Software\Autodesk\AutoCAD LT\R10" str1(9,0)= "Software\Autodesk\AutoCAD LT\R9" str1(10,0)= "Software\Autodesk\AutoCAD LT\R8" str1(11,0)= "Software\Autodesk\AutoCAD LT\R7" str1(12,0)= "Software\Autodesk\AutoCAD LT\R6" str1(13,0)= "Software\Autodesk\AutoCAD LT\R4" str1(14,0)= "Software\Autodesk\AutoCAD\R18.1" str1(15,0)= "Software\Autodesk\AutoCAD\R18.0" str1(16,0)= "Software\Autodesk\AutoCAD\R17.2" str1(17,0)= "Software\Autodesk\AutoCAD\R17.1" str1(18,0)= "Software\Autodesk\AutoCAD\R17.0" str1(19,0)= "Software\Autodesk\AutoCAD\R16.2" str1(20,0)= "Software\Autodesk\AutoCAD\R16.1" str1(21,0)= "Software\Autodesk\AutoCAD\R16.0" str1(22,0)= "Software\Autodesk\AutoCAD\R15.2" str1(23,0)= "Software\Autodesk\AutoCAD\R15.1" str1(24,0)= "Software\Autodesk\AutoCAD\R14.0" str1(25,0)= "Software\Autodesk\AutoCAD\R15.0" const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") 'Step 1: Read into an array, the values of each declared strkeypath, if exists. for i=0 to 25 oReg.EnumKey HKEY_LOCAL_MACHINE, str1(i,0), arrSubKeys For Each subkey In arrSubKeys str1(i,1)=subkey oReg.GetStringValue HKEY_LOCAL_MACHINE,str1(i,0) & "\" & subkey,"ProductName",str1(i,2) oReg.GetStringValue HKEY_LOCAL_MACHINE,str1(i,0) & "\" & subkey,"Release",str1(i,3) oReg.GetStringValue HKEY_LOCAL_MACHINE,str1(i,0) & "\" & subkey,"SerialNumber",str1(i,4) oReg.GetDwordValue HKEY_LOCAL_MACHINE,str1(i,0) & "\" & subkey,"StandaloneNetworkType",str1(i,5) if str1(i,2) <> "" then k=k+1 Next Next Dim wbemCimtypeString Dim wbemCimtypeUint32 wbemCimtypeString = 8 wbemCimtypeUint32 = 19 ' Remove classes Set oLocation = CreateObject("WbemScripting.SWbemLocator") Set oServices = oLocation.ConnectServer(,"root\cimv2") set oNewObject = oServices.Get("cm_AutoDesk") oNewObject.Delete_ if k > 0 then '================== 'Drop that into a custom wmi Namespace '================== ' Create data class structure '================== Set oDataObject = oServices.Get oDataObject.Path_.Class = "cm_AutoDesk" oDataObject.Properties_.add "KeyName" , wbemCimtypeString oDataObject.Properties_("KeyName").Qualifiers_.add "key" , True oDataObject.Properties_.add "ProductName" , wbemCimtypeString oDataObject.Properties_("ProductName").Qualifiers_.add "key" , True oDataObject.Properties_.add "Rel" , wbemCimtypeString oDataObject.Properties_.add "SerialNumber" , wbemCimtypeString oDataObject.Properties_.add "StandaloneNetworkType" , wbemCimtypeUint32 oDataObject.Put_ For j=0 to 25 if str1(j,1)="" then else Set oNewObject = oServices.Get("cm_AutoDesk" ).SpawnInstance_ oNewObject.KeyName = Str1(j,1) oNewObject.ProductName = str1(j,2) oNewObject.Rel = str1(j,3) oNewObject.SerialNumber = str1(j,4) oNewObject.StandaloneNetworkType = str1(j,5) oNewObject.Put_ 'uncomment the below 2 lines ONLY when testing interactively ' wscript.echo str1(j,0) & ", " & str1(j,1) & ", " & str1(j,2) &_ ' ", " & str1(j,3) & ", " & str1(j,4) & ", " & str1(j,5) end if next end if wscript.quit 'Mof Edit for sms_def.mof, if you use this. Remember to remove the ' before dropping in sms_def.mof! '//---------------- '//Mof edit for use with a DCM recurring script, or a recurring Advert script '//---------------- '[ SMS_Report (TRUE), ' SMS_Group_Name ("AutoDeskCombo"), ' SMS_Class_ID ("Custom|AutoDesk|1.0") ] ' 'class cm_AutoDesk : SMS_Class_Template '{ ' [SMS_Report (TRUE),key] string KeyName; ' [SMS_Report (TRUE) ] string ProductName; ' [SMS_Report (TRUE) ] string Rel; ' [SMS_Report (TRUE) ] string SerialNumber; ' [SMS_Report (TRUE) ] uint32 StandaloneNetworkType; '};