**RecoverKeys is a paid product and can be purchased here: http://recover-keys.com/en/order.html**
You can use the paid enterprise version of recover keys to retrieve any supported license keys. The script will upload an HTML file listing all of the keys retrieved from a system as well as write them to the registry so they can be retrieved with a custom inventory rule.
You will first need to install the program on your local system to get the file dependencies needed for the script to run successfully.
Most of the files needed will be found in the installation directory (default is c:\program files (x86)\recover keys). The files needed are:
- English.xml (found in the Lang directory)
- RecoverKeys4.zip.enc
- RecoverKeysCmd.exe
- Sqlite3.dll
- Licensekeys_rk23.vbs (link to download: https://docs.google.com/open?id=0BxH6X8H1Q3CRYUZRSTZveUZDTlk)
We will configure a script as shown below to run the program and gather our keys.
Configure your script as an Offline Kscript. Configure the tasks as shown above. The parameters section for steps 1, 3, and 4 are below so you can copy and paste.
1 -scanlocal -HTML -hideheader -key:YOURKEYHERE -FILE:"$(KACE_DEPENDENCY_DIR)\rk.html"
3 -scanlocal -TSF -hideheader -key:YOURKEYHERE -FILE:"$(KACE_DEPENDENCY_DIR)\rktab.txt"
4 "$(KACE_DEPENDENCY_DIR)\licensekeys_rk23.vbs" "/path:$(KACE_DEPENDENCY_DIR)\rktab.txt"
Once this is configured save all the changes then save the script itself. You can now choose machines to run the script on whatever schedule you wish.
The VBS file in the script will write the keys to the registry so they can be added to the inventory with a custom inventory rule. Once they are part of the inventory you can report against those fields.
To create a record with a custom inventory rule, go to Inventory > Software. Click the Choose Action drop down and choose add new item.
Name the record and then fill in the custom inventory rule section. We will be using "RegistryValueReturn" for this instance. The keys will be stored in one of two places. On 64-bit systems it will be "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\kace\Software Licenses All". On 32-bit sytems it will be "HKEY_LOCAL_MACHINE\SOFTWARE\kace\Software Licenses All"
Here is an example custom inventory rule "RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\kace\Software Licenses All, Windows 7 Enterprise License Key, REG_SZ)"
That will return the key under the custom inventory rules section of the systems inventory. You can create multiple inventory rules to pull in the software items of your choice.
RESOURCES:
Command line syntax: http://recover-keys.com/kb/command-line-version.html
"COMPUTERNAME" tab "MAIN SCAN" tab "SOFTWARE TITLE" tab "LICENSE KEY" tab "ACTUAL KEY"
I am only getting the last entry in the txt file. It creates the Software Title and then creates a REG_SZ that says Product Key with no data in it. Any direction you could point me in for this?
Thank you, - Hammer1790 11 years ago
Thanks again for the tutorial! - Hammer1790 11 years ago
Could you share with me what version you are using and what you had to do in order to make the VBS work for you? - WhitzEnd 11 years ago
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrFields = Split(strLine, vbTab)
strSoftwareName = arrFields(2)
Wscript.Echo arrFields(3)
IF arrFields(3) = chr(34) & "License Key" & chr(34) Then
strLicense = arrFields(3)
strProduct = arrFields(4)
strSoftwareName1 = mid(strSoftwareName,2,len(strSoftwareName)-2)
strLicense1 = mid(strLicense,2,len(strLicense)-2)
strProduct1 = mid(strProduct,2,len(strProduct)-2)
strValueName = strSoftwareName1 & " License Key"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strProduct1
WScript.Echo strValueName & " = " & strProduct1
ELSE
WScript.Echo "Skipping due to false value"
End IF
Loop
Everything else was perfect for me. Thanks again for the post. Definitely saved a ton of time. - Hammer1790 11 years ago
Currently using RecoverKeys 8.0.3.109. - tdickinson 10 years ago