Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.
Endpoint Management Community Blog

Altiris 7.1 Custom inventory for Autodesk

Autodesk Inventory
Created: 24 Jul 2014 • Updated: 24 Jul 2014
Kevin Haysmer's picture
+1 1 Vote
Login to vote

I started to hunt as many have before for a custom inventory for Altiris 7.1 that would get the Autodesk information like in Altiris 6.5. Every time I thought I had the script working I would find a different product it was not getting the information on correctly. Or in some case it just would not read a registry field like it would all the others. As I started to look I found the reason was not all the registry fields patterns where the same in about 2012 they changed the format of the registry configuration. There are also other products in Autodesk that the path in the registry was different or the field I wanted had a different name from one product to the next. So I started to compile a list of all the software I may need and looked for the registry keys I would need to make a functional custom inventory script for Autodesk. Just so we can all get it out yes I know I could have broken parts of this down into functions and had the script shorter but at the time I was not thinking about that. This script is VBS with tables in altiris as follows: ProductName, Release, SerialNumber, LocaleID, KeyName and StandaloneNetworkType. I found as I worked through this KeyName was no longer needed but rather then make a new Altiris inventory table I left it and have my script filling the column with "No Longer Needed"  You can leave it or remove that is your call.

 

 

  '===================================================================================================================
'      On Error Resume Next

'Create instance of Wbem service object and connect to namespace
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") 

'====================================================================================================================
'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 ("{<Custom Inventory table GUID>}")

Dim objDataClass
Set objDataClass = nse.AddDataBlock (objDCInstance)
'==============================================================================

Dim oShell
Set oShell = CreateObject("WScript.Shell")
Dim sCompName, strProductName, objItems, i

'List of Autodesk products to review
Dim objAutodeskProducts  'Create a variable that will be a Dictionary
Set objAutodeskProducts = CreateObject("Scripting.Dictionary")

objAutodeskProducts.Add "0", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-5001:409" 
objAutodeskProducts.Add "1", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7001:409" 
objAutodeskProducts.Add "2", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7001:416" 
objAutodeskProducts.Add "3", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7007:409" 
objAutodeskProducts.Add "4", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7002:409" 
objAutodeskProducts.Add "5", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R11\ACLT-4001:409" 
objAutodeskProducts.Add "6", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R12\ACADLT-5001:409"
objAutodeskProducts.Add "7", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R13\ACADLT-6001:409" 
objAutodeskProducts.Add "8", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R14\ACADLT-7001:409" 
objAutodeskProducts.Add "9", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R14\ACADLT-7001:410" 

objItems = objAutodeskProducts.Items
For i = 0 To objAutodeskProducts.Count -1
sCompName = objItems(i)

strProductName = sCompName & "\ProductName"

If KeyExists(strProductName)Then

strProductName = oShell.RegRead(sCompName & "\ProductName")
strRelease = oShell.RegRead(sCompName & "\Release")
strSerialNumber = oShell.RegRead(sCompName & "\SerialNumber")
strLocaleID = oShell.RegRead(sCompName & "\LocaleID")
strKeyName = "No longer inventoried"
strStandaloneNetworkType = oShell.RegRead(sCompName & "\StandaloneNetworkType")

            'Add a new row
            dim objDataRow
            set objDataRow = objDataClass.AddRow
                'Set columns
                objDataRow.SetField 0, strProductName
                objDataRow.SetField 1, strRelease
                objDataRow.SetField 2, strSerialNumber
                objDataRow.SetField 3, strLocaleID
                objDataRow.SetField 4, strKeyName
                objDataRow.SetField 5, strStandaloneNetworkType
        
End If
Next

Dim oShell2
Set oShell2 = CreateObject("WScript.Shell")
Dim sCompName2, strProductName2, objItems2, i2

'List of Autodesk products to review
Dim objAutodeskProducts2  'Create a variable that will be a Dictionary
Set objAutodeskProducts2 = CreateObject("Scripting.Dictionary")

objAutodeskProducts2.Add "0", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409" 
objAutodeskProducts2.Add "1", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A001:409" 
objAutodeskProducts2.Add "2", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A001:40A" 
objAutodeskProducts2.Add "3", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.1\ACAD-9004:409" 
objAutodeskProducts2.Add "4", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A000:409" 
objAutodeskProducts2.Add "5", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8007:409" 
objAutodeskProducts2.Add "6", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A007:409" 
objAutodeskProducts2.Add "7", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8002:409" 
objAutodeskProducts2.Add "8", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.1\ACAD-9002:409" 
objAutodeskProducts2.Add "9", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A002:409" 
objAutodeskProducts2.Add "10", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.1\ACAD-9005:409" 
objAutodeskProducts2.Add "11", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.2\ACAD-A005:409" 
objAutodeskProducts2.Add "12", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R15\ACADLT-8001:409" 
objAutodeskProducts2.Add "13", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R16\ACADLT-9001:409" 
objAutodeskProducts2.Add "14", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R16\ACADLT-9001:40A" 
objAutodeskProducts2.Add "15", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R17\ACADLT-A001:409" 

objItems2 = objAutodeskProducts2.Items
For i2 = 0 To objAutodeskProducts2.Count -1
sCompName2 = objItems2(i2)

strProductName2 = sCompName2 & "\ProductName"

If KeyExists(strProductName2)Then

strProductName2 = oShell2.RegRead(sCompName2 & "\ProductName")
strRelease2 = oShell2.RegRead(sCompName2 & "\Release")
strSerialNumber2 = oShell2.RegRead(sCompName2 & "\SerialNumber")
strLocaleID2 = oShell2.RegRead(sCompName2 & "\LocaleID")
strKeyName2 = "No longer inventoried"
strStandaloneNetworkType2 = oShell2.RegRead(sCompName2 & "\AdLM\Type")

'           Add a new row
            dim objDataRow2
            set objDataRow2 = objDataClass.AddRow
'               Set columns
                objDataRow2.SetField 0, strProductName2
                objDataRow2.SetField 1, strRelease2
                objDataRow2.SetField 2, strSerialNumber2
                objDataRow2.SetField 3, strLocaleID2
                objDataRow2.SetField 4, strKeyName2
                objDataRow2.SetField 5, strStandaloneNetworkType2
        
End If
Next

Dim oShell3
Set oShell3 = CreateObject("WScript.Shell")
Dim sCompName3, strProductName3, objItems3, i3

'List of Autodesk products to review
Dim objAutodeskProducts3  'Create a variable that will be a Dictionary
Set objAutodeskProducts3 = CreateObject("Scripting.Dictionary")

objAutodeskProducts3.Add "0", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.0\ACAD-B001:409" 
objAutodeskProducts3.Add "1", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.0\ACAD-B001:40A" 
objAutodeskProducts3.Add "2", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.1\ACAD-D001:409" 
objAutodeskProducts3.Add "3", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R20.0\ACAD-E001:409" 
objAutodeskProducts3.Add "4", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.0\ACAD-B000:409" 
objAutodeskProducts3.Add "5", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.0\ACAD-B007:409" 
objAutodeskProducts3.Add "6", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.1\ACAD-D005:409" 

objItems3 = objAutodeskProducts3.Items
For i3 = 0 To objAutodeskProducts3.Count -1
sCompName3 = objItems3(i3)
strSubName3 = left(sCompName3,60)

strProductName3 = sCompName3 & "\ProductName"

If KeyExists(strProductName3)Then

strProductName3 = oShell3.RegRead(sCompName3 & "\ProductName")
strRelease3 = oShell3.RegRead(sCompName3 & "\Release")
strSerialNumber3 = oShell3.RegRead(sCompName3 & "\SerialNumber")
strLocaleID3 = oShell3.RegRead(sCompName3 & "\LocaleID")
strKeyName3 = "No longer inventoried"
strStandaloneNetworkType3 = oShell3.RegRead(strSubName3 & "\AdLM\Type")

'           Add a new row
            dim objDataRow3
            set objDataRow3 = objDataClass.AddRow
'               Set columns
                objDataRow3.SetField 0, strProductName3
                objDataRow3.SetField 1, strRelease3
                objDataRow3.SetField 2, strSerialNumber3
                objDataRow3.SetField 3, strLocaleID3
                objDataRow3.SetField 4, strKeyName3
                objDataRow3.SetField 5, strStandaloneNetworkType3
        
End If
Next

Dim oShell4
Set oShell4 = CreateObject("WScript.Shell")
Dim sCompName4, strProductName4, objItems4, i4

'List of Autodesk products to review
Dim objAutodeskProducts4  'Create a variable that will be a Dictionary
Set objAutodeskProducts4 = CreateObject("Scripting.Dictionary")

objAutodeskProducts4.Add "0", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R18\ACADLT-B001:409" 
objAutodeskProducts4.Add "1", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R18\ACADLT-B001:40A" 
objAutodeskProducts4.Add "2", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R20\ACADLT-D001:409" 
objAutodeskProducts4.Add "3", "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD LT\R20\ACADLT-D001:40C" 

objItems4 = objAutodeskProducts4.Items
For i4 = 0 To objAutodeskProducts4.Count -1
sCompName4 = objItems4(i4)
strSubName4 = left(sCompName4,63)

strProductName4 = sCompName4 & "\ProductName"

If KeyExists(strProductName4)Then

strProductName4 = oShell4.RegRead(sCompName4 & "\ProductName")
strRelease4 = oShell4.RegRead(sCompName4 & "\Release")
strSerialNumber4 = oShell4.RegRead(sCompName4 & "\SerialNumber")
strLocaleID4 = oShell4.RegRead(sCompName4 & "\LocaleID")
strKeyName4 = "No longer inventoried"
strStandaloneNetworkType4 = oShell4.RegRead(strSubName4 & "\AdLM\Type")

'           Add a new row
            dim objDataRow4
            set objDataRow4 = objDataClass.AddRow
'               Set columns
                objDataRow4.SetField 0, strProductName4
                objDataRow4.SetField 1, strRelease4
                objDataRow4.SetField 2, strSerialNumber4
                objDataRow4.SetField 3, strLocaleID4
                objDataRow4.SetField 4, strKeyName4
                objDataRow4.SetField 5, strStandaloneNetworkType4
        
End If
Next

Dim oShell5
Set oShell5 = CreateObject("WScript.Shell")
Dim sCompName5, strProductName5

sCompName5 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R15.0\ACAD-1:409" 

strProductName5 = sCompName5 & "\ProductName"

If KeyExists(strProductName5)Then

strProductName5 = oShell5.RegRead(sCompName5 & "\ProductName")
strRelease5 = oShell5.RegRead(sCompName5 & "\Release")
strSerialNumber5 = oShell5.RegRead(sCompName5 & "\SerialNumber")
strLocaleID5 = oShell5.RegRead(sCompName5 & "\LocaleID")
strKeyName5 = "No longer inventoried"
strStandaloneNetworkType5 = "Autodesk 2000 no network type"

'           Add a new row
            dim objDataRow5
            set objDataRow5 = objDataClass.AddRow
'               Set columns
                objDataRow5.SetField 0, strProductName5
                objDataRow5.SetField 1, strRelease5
                objDataRow5.SetField 2, strSerialNumber5
                objDataRow5.SetField 3, strLocaleID5
                objDataRow5.SetField 4, strKeyName5
                objDataRow5.SetField 5, strStandaloneNetworkType5
        
End If
'Next 

Dim oShell6
Set oShell6 = CreateObject("WScript.Shell")
Dim sCompName6, strProductName6

sCompName6 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Inventor\RegistryVersion18.0"

strProductName6 = sCompName6 & "\ProductName"

If KeyExists(strProductName6)Then

strProductName6 = oShell6.RegRead(sCompName6 & "\ProductName")
strRelease6 = oShell6.RegRead(sCompName6 & "\ProductVersion")
strSerialNumber6 = oShell6.RegRead(sCompName6 & "\SerialNumber")
strLocaleID6 = "No Local ID"
strKeyName6 = "No longer inventoried"
strStandaloneNetworkType6 = oShell6.RegRead(sCompName6 & "\LicenseMode")

'           Add a new row
            dim objDataRow6
            set objDataRow6 = objDataClass.AddRow
'               Set columns
                objDataRow6.SetField 0, strProductName6
                objDataRow6.SetField 1, strRelease6
                objDataRow6.SetField 2, strSerialNumber6
                objDataRow6.SetField 3, strLocaleID6
                objDataRow6.SetField 4, strKeyName6
                objDataRow6.SetField 5, strStandaloneNetworkType6
        
End If
'Next 

Dim oShell7
Set oShell7 = CreateObject("WScript.Shell")
Dim sCompName7, strProductName7

sCompName7 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Navisworks Simulate\11.0"

strProductName7 = sCompName7 & "\ProductName"

If KeyExists(strProductName7)Then

strProductName7 = oShell7.RegRead(sCompName7 & "\NAVSIM-1\Product Name")
strRelease7 = oShell7.RegRead(sCompName7 & "\NAVSIM-1\Version")
strSerialNumber7 = oShell7.RegRead(sCompName7 & "\NAVSIM-1\Serial Number")
strLocaleID7 = "No Local ID"
strKeyName7 = "No longer inventoried"
strStandaloneNetworkType7 = oShell7.RegRead(sCompName7 & "\AdLM\Type")

'           Add a new row
            dim objDataRow7
            set objDataRow7 = objDataClass.AddRow
'               Set columns
                objDataRow7.SetField 0, strProductName7
                objDataRow7.SetField 1, strRelease7
                objDataRow7.SetField 2, strSerialNumber7
                objDataRow7.SetField 3, strLocaleID7
                objDataRow7.SetField 4, strKeyName7
                objDataRow7.SetField 5, strStandaloneNetworkType7
        
End If
'Next 

Dim oShell8
Set oShell8 = CreateObject("WScript.Shell")
Dim sCompName8, strProductName8

sCompName8 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Navisworks Simulate x64\11.0"

strProductName8 = sCompName8 & "\ProductName"

If KeyExists(strProductName8)Then

strProductName8 = oShell8.RegRead(sCompName8 & "\NAVSIM-1\Product Name")
strRelease8 = oShell8.RegRead(sCompName8 & "\NAVSIM-1\Version")
strSerialNumber8 = oShell8.RegRead(sCompName8 & "\NAVSIM-1\Serial Number")
strLocaleID8 = "No Local ID"
strKeyName8 = "No longer inventoried"
strStandaloneNetworkType8 = oShell8.RegRead(sCompName8 & "\AdLM\Type")

'           Add a new row
            dim objDataRow8
            set objDataRow8 = objDataClass.AddRow
'               Set columns
                objDataRow8.SetField 0, strProductName8
                objDataRow8.SetField 1, strRelease8
                objDataRow8.SetField 2, strSerialNumber8
                objDataRow8.SetField 3, strLocaleID8
                objDataRow8.SetField 4, strKeyName8
                objDataRow8.SetField 5, strStandaloneNetworkType8
        
End If
'Next 

Dim oShell9
Set oShell9 = CreateObject("WScript.Shell")
Dim sCompName9, strProductName9

sCompName9 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Revit"

strProductName9 = sCompName9 & "\ProductName"

If KeyExists(strProductName9)Then

strProductName9 = oShell9.RegRead(sCompName9 & "\2014\REVIT-05:0409\ProductName")
strRelease9 = oShell9.RegRead(sCompName9 & "\2014\REVIT-05:0409\Version")
strSerialNumber9 = oShell9.RegRead(sCompName9 & "\2014\REVIT-05:0409\SerialNumber")
strLocaleID9 = "No Local ID"
strKeyName9 = "No longer inventoried"
strStandaloneNetworkType9 = oShell9.RegRead(sCompName9 & "\Autodesk Revit 2014\AdLM\Type")

'           Add a new row
            dim objDataRow9
            set objDataRow9 = objDataClass.AddRow
'               Set columns
                objDataRow9.SetField 0, strProductName9
                objDataRow9.SetField 1, strRelease9
                objDataRow9.SetField 2, strSerialNumber9
                objDataRow9.SetField 3, strLocaleID9
                objDataRow9.SetField 4, strKeyName9
                objDataRow9.SetField 5, strStandaloneNetworkType9
        
End If
'Next 

Dim oShell10
Set oShell10 = CreateObject("WScript.Shell")
Dim sCompName10, strProductName10

sCompName10 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Structural"

strProductName10 = sCompName10 & "\ProductName"

If KeyExists(strProductName10)Then

strProductName10 = oShell10.RegRead(sCompName10 & "\RSA\27.0\RSAPRO-2014:409\Product Name")
strRelease10 = oShell10.RegRead(sCompName10 & "\RSA\27.0\RSAPRO-2014:409\Version")
strSerialNumber10 = oShell10.RegRead(sCompName10 & "\RSA\27.0\RSAPRO-2014:409\Serial Number")
strLocaleID10 = "No Local ID"
strKeyName10 = "No longer inventoried"
strStandaloneNetworkType10 = oShell10.RegRead(sCompName10 & "\License\RSA 2014\LicType")

'           Add a new row
            dim objDataRow10
            set objDataRow10 = objDataClass.AddRow
'               Set columns
                objDataRow10.SetField 0, strProductName10
                objDataRow10.SetField 1, strRelease10
                objDataRow10.SetField 2, strSerialNumber10
                objDataRow10.SetField 3, strLocaleID10
                objDataRow10.SetField 4, strKeyName10
                objDataRow10.SetField 5, strStandaloneNetworkType10
        
End If
'Next 

Dim oShell11
Set oShell11 = CreateObject("WScript.Shell")
Dim sCompName11, strProductName11

sCompName11 = "HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\3dsMaxDesign\16.0"

strProductName11 = sCompName11 & "\ProductName"

If KeyExists(strProductName11)Then

strProductName11 = oShell11.RegRead(sCompName11 & "\ProductName")
strRelease11 = oShell11.RegRead(sCompName11 & "\Release")
strSerialNumber11 = oShell11.RegRead(sCompName11 & "\SerialNumber")
strLocaleID11 = "No Local ID"
strKeyName11 = "No longer inventoried"
strStandaloneNetworkType11 = oShell11.RegRead(sCompName11 & "\AdLM\Type")

'           Add a new row
            dim objDataRow11
            set objDataRow11 = objDataClass.AddRow
'               Set columns
                objDataRow11.SetField 0, strProductName11
                objDataRow11.SetField 1, strRelease11
                objDataRow11.SetField 2, strSerialNumber11
                objDataRow11.SetField 3, strLocaleID11
                objDataRow11.SetField 4, strKeyName11
                objDataRow11.SetField 5, strStandaloneNetworkType11
        
End If
'Next 

nse.SendQueued

Function KeyExists(key)
    Dim objShell
    On Error Resume Next
    Set objShell = CreateObject("WScript.Shell")
        objShell.RegRead (key)
    Set objShell = Nothing
    If Err = 0 Then KeyExists = True
End Function