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)
Altiris:
NS 6 R13, Administrator access to the Altiris Database, access to your Microsoft Eopen account
Local Systems:
WMI Service, local administrator rights
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"
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
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
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
<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>
"C:\Program Files (x86)\Altiris\Altiris Agent\Software Delivery\{use guid form local machine}\cache\aexcustinv.exe" /in .\Key.xml / /out Key.nsi
Key.bat Key.xml Key.ini (blank file) keybatch.bat file.vbs Remove test.bat
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.
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.
Will this work on Altiris 8.1 HF2???
Thanks
Hi, can you confirm the tables and columns that you created for this please?