Asset Management Suite

 View Only

Microsoft License Key Inventory 

Aug 03, 2011 01:07 PM

Steps to create a Microsoft License Key Inventory for Vista, Windows 7, Windows 2008 32 bit, Windows 2008 64 bit, Windows 2008 R2

(Microsoft no longer stores Key information in the Registry, therefore using slmgr will allow you access to the last 5 digits of the Product Key)

Prerequisites:

Altiris:

NS 6 R13, Administrator access to the Altiris Database, access to your Microsoft Eopen account

Local Systems:

WMI Service, local administrator rights

Steps:

  1. Create a folder in C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Software Delivery Packages\ your folder on your Notification Server.
  2. From C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Inventory Solution copy AeXCustInv.exe and AeXInvSoln.exe and past into C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Software Delivery Packages\ your folder
  3. Create a blank test.bat file in C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Software Delivery Packages\ your folder
  4. Create a Software Delivery Package (Resources>Software Management>Software Delivery Packages>Windows: Right click, New>Software Delivery Package:) and use C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Software Delivery Packages\ your folder as your Package Location
  5. Create the Program: Click on the Programs tab. Click New. Use the test.bat as your Command line.
  6. Create a Collection for the machine you have administrator rights too.
  7. Create the Software Delivery Task: Select the Package you created in step 4. Select the Collection you created in Step 6. Ensure you Enable the task and click Apply. Also click on the Go To Package and click Update Distribution Points.
  8. Log into the machine you have administrator rights too. Open the Altiris Agent and Update the Configuration than go to C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery and find the guid for the Software Delivery Package you created. Copy and Save it. You will need this to create the files for the inventory.
  9. Create a batch file: (keybatch.bat)
    Cd\
    Cd\windows\system32\
    Cscript slmgr.vbs /dli > "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\file.txt"
    
    "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\file.vbs" we will create the file.vbs later
    
    ping localhost -n 10 > nul
    "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\key.bat"
  10. Create the file.vbs
    1. NOTE: TheVBscript supports Windows Scripting Host 5.7 (Windows Vista and Windows Server 2008).
      dim sOutputFilename, fInput, fOutput, sLine
      sInputFileName = "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\key.txt"
      sOutputFilename = "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\key.ini"
      Set fs = CreateObject("Scripting.FileSystemObject")
      Const ForReading = 1, ForWriting = 2, ForAppending = 8
      set fInput = fs.OpenTextFile(sInputFileName, ForReading, True)
      set fOutput = fs.OpenTextFile(sOutputFileName, ForWriting, False)
      
      fOutput.WriteLine("[File Header]")
      
      sLine = fInput.ReadLine
      sLine = fInput.ReadLine
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var1=" & sLine)
      
      sLine = fInput.ReadLine
      
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var2=" & sLine)
      
      
      fInput.Close
      fOutput.Close
    2. NOTE: The VBscript supports Windows Scripting Host 5.8 (Windows 7 and Windows Server 2008 R2).
      dim sOutputFilename, fInput, fOutput, sLine
      sInputFileName = "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}}\cache\key.txt"
      sOutputFilename = "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}}\cache\key.ini"
      Set fs = CreateObject("Scripting.FileSystemObject")
      Const ForReading = 1, ForWriting = 2, ForAppending = 8
      set fInput = fs.OpenTextFile(sInputFileName, ForReading, True)
      set fOutput = fs.OpenTextFile(sOutputFileName, ForWriting, False)
      
      fOutput.WriteLine("[File Header]")
      
      sLine = fInput.ReadLine
      sLine = fInput.ReadLine
      sLine = fInput.ReadLine
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var1=" & sLine)
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var2=" & sLine)
      
      
      fInput.Close
      fOutput.Close
    3. NOTE: The VBscript supports Windows Server 2008 32bit.
      dim sOutputFilename, fInput, fOutput, sLine
      sInputFileName = "C:\Program Files\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\key.txt"
      sOutputFilename = "C:\Program Files\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\key.ini"
      Set fs = CreateObject("Scripting.FileSystemObject")
      Const ForReading = 1, ForWriting = 2, ForAppending = 8
      set fInput = fs.OpenTextFile(sInputFileName, ForReading, True)
      set fOutput = fs.OpenTextFile(sOutputFileName, ForWriting, False)
      
      fOutput.WriteLine("[File Header]")
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var1=" & sLine)
      
      fInput.ReadLine
      sLine = fInput.ReadLine
      fOutput.WriteLine("Var2=" & sLine)
      fInput.Close
      fOutput.Close
  11. Create key.xml for Custom Inventory
    <InventoryClasses>
    
    <InventoryClass name="Aex OS 2008 License Key" manufacturer='Altiris' description='2008 License Key Data' platform='Win32' version='1.0' mifClass='ALTIRIS|AEX_OS_2008_License_Key|1.0'>
    <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
    <s:Schema id="RowsetSchema">
    <s:ElementType name="row" content="eltOnly" rs:updatable="true">
    <s:AttributeType name="c0" rs:name="Product Name" rs:number="1" rs:nullable="true" mifAttrId="1">
    <s:datatype dt:type="string" dt:maxLength="255"/>
    </s:AttributeType>
    <s:AttributeType name="c1" rs:name="Product Partial OS Key" rs:number="2" rs:nullable="true" mifAttrId="2">
    <s:datatype dt:type="string" dt:maxLength="255"/>
    </s:AttributeType>
    </s:ElementType>
    </s:Schema>
    <rs:data>
    <%set inipath= "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache"%>
    <z:row
    c0="<%writexml "ini:%inipath%\key.ini\[Os Key Data]\Var1"%>"
    c1="<%writexml "ini:%inipath%\key.ini\[Os Key Data]\Var2"%>"
    
    />
    </rs:data>
    </xml>
    </InventoryClass>
    </InventoryClasses>
  12. Create batch file to create NSI
    "C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\aexcustinv.exe" /in .\Key.xml / /out Key.nsi
  13. Copy all files to C:\Program Files\Altiris\Notification Server\NSCap\Bin\Win32\X86\Software Delivery Packages\ your folder
    Key.bat
    
    Key.xml
    
    Key.ini (blank file)
    
    keybatch.bat
    
    file.vbs
    
    Remove test.bat
  14. Go to the Task you created and click on Go To Package> Update Distribution Points.
    Ensure the Task is set to "User can run this task immediately"
  15. Download all your license key data from Eopen. Take the last five digits of the License Key and create a new column. Column Data needs to be exactly (Partial Product Key: BBBBB) where BBBBB is the last 5 digits of the License Key.
  16. Import the table into the Altiris Database. Now you can create a report
  17. Create the Report
    select
    vc.[Name],
    vc.[Domain],
    vc.[IP Address],
    pk.[ProductName],
    pk.[ProductKey],
    pk.[Company],
    vc.[System Type]
    from AeX_SW_Microsoft_OS_Keys pk
    inner join Inv_Aex_OS_2008_License_Key lk on lk.[Product Partial OS Key] = pk.[partialproductkey]
    inner join vcomputer vc on vc.guid = lk._resourceguid
    order by 1
    
    AeX_SW_Microsoft_OS_Keys is the table you imported into the Altiris Database from Eopen data.
    
    Inv_Aex_OS_2008_License_Key is the inventory table created by the NSI from the local machine.

Notes:

This process will only put the NSI in the Express\Inventory folder. You will need to make sure you have an Inventory Task enabled to ensure the AeXInvCollector runs and sends the NSI to the Notification Server.

If you have multiple OS's in your environment you will need to create a separateCollection, Package and Task for each OS.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Aug 17, 2017 07:26 PM

Will this work on Altiris 8.1 HF2???

Thanks

Aug 30, 2011 10:08 AM

Hi, can you confirm the tables and columns that you created for this please?

Related Entries and Links

No Related Resource entered.