Solved

Read an Adobe License Key

Posted on 2013-10-25
4
943 Views
Last Modified: 2013-11-04
I'm using the following WMIC script to basically inventory software.  I'm trying to find Adobe Acrobat Standard plus the license key.

wmic /node:pc name product list brief  Is there something I can add to read the license key?
0
Comment
Question by:WellingtonIS
  • 3
4 Comments
 
LVL 50

Expert Comment

by:jcimarron
Comment Utility
WellingtonIS --
You have not told us the version of Acrobat that is installed.  The Acrobat serial number is located by accessing the Registry key indicated for your version of Acrobat  here
http://www.magicaljellybean.com/keyfinder.cfg

Or another approach
http://www.ehow.com/how_5793106_serial-number-adobe-acrobat-computer.html
0
 

Author Comment

by:WellingtonIS
Comment Utility
The version is Probably Acrobat 9 not the reader I have about 1200 machines to look though. I'm basically looking for something that can read that key and report it back to me.  I was hoping to add upon my WMIC script.  Basically I need something to read and report
HKEY_LOCAL_MACHINE\Software\Adobe\Adobe Acrobat\9.0\Registration
Serial Number: 9101-8896-2565-8996-9572-6186
    Adobe Key: 1016-1745-0229-9928-2700-8418
0
 

Accepted Solution

by:
WellingtonIS earned 0 total points
Comment Utility
I found a script by searching this site it worked great.  Here it is.
'***********'****************************************
'Get Product Keys
' Original source: http://www.visualbasicscript.com/Looking-for-a-working-VBscript-to-pull-back-the-Office-2010-Key-m89687.aspx
' Modified by:
'       Robert Sampson
'       EE Member Profile: http://www.experts-exchange.com/M_3820065.html
'      7-Jul-2011
'***************************************************

If WScript.Arguments.Count = 0 Then
      MsgBox "Please drag a text file that contains computer names onto this script file for processing."
      WScript.Quit
End If

strInputFile = WScript.Arguments.Item(0)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const intForReading = 1
Set objInputFile = objFSO.OpenTextFile(strInputFile, intForReading, False)
strResultsFile = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "Results_" & Replace(TimeNow(Now), "-", "") & ".csv"
Set objResultsFile = objFSO.CreateTextFile(strResultsFile, True)
strNoContactFile = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "NoContact_" & Replace(TimeNow(Now), "-", "") & ".txt"
Set objNoContactFile = objFSO.CreateTextFile(strNoContactFile, True)

arrProducts = Array("Microsoft Windows", "Office XP", "Office 2003", "Office 2007", "Office 2010", "Adobe Acrobat")

objResultsFile.WriteLine """Host Name"",""IP Address(es)"",""Model"",""Serial Number"",""Windows Key"",""Office Keys"""

'Bind to the registry
'***************************************************
Const HKEY_LOCAL_MACHINE = &H80000002

While Not objInputFile.AtEndOfStream
      strComputer = Trim(objInputFile.ReadLine)
      If strComputer <> "" Then
            If Ping(strComputer) = True Then
                  On Error Resume Next
                  Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                  Set oReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
                  If Err.Number = 0 Then
                        On Error GoTo 0
                        Set objInstalled = CreateObject("Scripting.Dictionary")
      
                        ' GET THE IP ADDRESS(ES)
                        Set colComputerIP = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration")
                        strIPAddress = ""
                        For Each IPConfig In colComputerIP
                              If Not IsNull(IPConfig.IPAddress) Then
                                    For intIPCount = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
                                          If IPConfig.IPAddress(intIPCount) <> "0.0.0.0" Then
                                                If strIPAddress = "" Then
                                                      strIPAddress = IPConfig.IPAddress(intIPCount)
                                                Else
                                                      strIPAddress = strIPAddress & ";" & IPConfig.IPAddress(intIPCount)
                                                End If
                                          End If
                                    Next
                              End If
                        Next
      
                        ' GET THE SERIAL NUMBER
                        Set colBIOS = objWMIService.ExecQuery("Select SerialNumber from Win32_BIOS")
                        For Each objBIOS In colBIOS
                              strSN = objBIOS.SerialNumber
                        Next
                        
                        ' GET THE COMPUTER MODEL AND HOSTNAME
                        Set colComputer = objWMIService.ExecQuery("Select Model, Name from Win32_ComputerSystem")
                        For Each objComp In colComputer
                              strModel = objComp.Model
                              strHostname = objComp.Name
                        Next
      
                        For Each strProduct In arrProducts
                              Select Case LCase(strProduct)
                                    Case LCase("Microsoft Windows")
                                          oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", strProductName
                                          strDecodedKey = sGetWindowsKey(strComputer)                  
                                          'Windows Server 2003 SBS check - as the ProductID just pulls back "Microsoft Windows Server 2003" only
                                          'If product name is the 2003 one, then search for a typical SBS reg key
                                          If strProductName = "Microsoft Windows Server 2003" Then
                                                On Error Resume Next
                                                objSBScheck = registryread("HKLM\SOFTWARE\Microsoft\SmallBusinessServer\SBSProgramDir")
                                                oReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\SmallBusinessServer", "SBSProgramDir", strSBSProgramDir
                                                If IsNull(strSBSProgramDir) = False Then strProductName = strProductName & " SBS"
                                          End If
                                          If objInstalled.Exists(strProductName) = False Then
                                                objInstalled.Add strProductName, strDecodedKey
                                          Else
                                                If objInstalled(strProductName) <> strDecodedKey Then objInstalled(strProductName) = objInstalled(strProductName) & "," & strDecodedKey
                                          End If
                                    Case LCase("Office XP"), LCase("Office 2003"), LCase("Office 2007")
                                          strOSArchitecture = GetOSArchitecture(strComputer)
                                          If strOSArchitecture  = "64" Then
                                                strInitialLocation = "SOFTWARE\Wow6432Node\"
                                          Else
                                                strInitialLocation = "SOFTWARE\"
                                          End If
                                          If LCase(strProduct) = LCase("Office XP") Then
                                                strVersion = "10.0"
                                          ElseIf LCase(strProduct) = LCase("Office 2003") Then
                                                strVersion = "11.0"
                                          ElseIf LCase(strProduct) = LCase("Office 2007") Then
                                                strVersion = "12.0"
                                          End If
                                          strDetails = GetOfficeKeys(strComputer, strInitialLocation & "Microsoft\Office\" & strVersion & "\Registration")
                                          arrDetails = Split(strDetails, "|")
                                          For intItem = LBound(arrDetails) To (UBound(arrDetails) - 1) Step 2
                                                strProductName = arrDetails(intItem)
                                                strDecodedKey = arrDetails(intItem + 1)
                                                If objInstalled.Exists(strProductName) = False Then
                                                      objInstalled.Add strProductName, strDecodedKey
                                                Else
                                                      If objInstalled(strProductName) <> strDecodedKey Then objInstalled(strProductName) = objInstalled(strProductName) & "," & strDecodedKey
                                                End If
                                          Next
                                    Case LCase("Office 2010")
                                          'strOffice2010AppId = "59a52881-a989-479d-af46-f275c6370663"
                                          On Error Resume Next
                                          Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
                                          Set colItems = objWMI.ExecQuery("SELECT ApplicationID,Name,ProductKeyID FROM OfficeSoftwareProtectionProduct")
                                          For Each objItem In colItems
                                          '      If (LCase(objItem.ApplicationId) = strOffice2010AppId) Then
                                                      If objItem.ProductKeyID <> "" Then
                                                            strDecodedKey = DecodeOfficeKey(objItem.ProductKeyID)
                                                            If objInstalled.Exists(objItem.Name) = False Then
                                                                  objInstalled.Add objItem.Name, strDecodedKey
                                                            Else
                                                                  If objInstalled(objItem.Name) <> strDecodedKey Then objInstalled(objItem.Name) = objInstalled(objItem.Name) & "," & strDecodedKey
                                                            End If
                                                      End If
                                          '      End If
                                          Next
                                          Err.Clear
                                          On Error GoTo 0
                                    Case LCase("Adobe Acrobat")
                                          'Get the adobe serial from the registry.
                                          strKeyPath = "Software\Adobe\Adobe Acrobat"
                                          oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
                                    
                                          'Check to see if there is any subkeys, if not, do not run!
                                          strVersionInfo = ""
                                          If Not IsNull (arrSubkeys) Then
                                                For Each strSubkey In arrSubKeys
                                                      bDigitalProductID = Null
                                                      oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & strSubkey & "\Registration", "SERIAL", strEncryptedKey
                                                      If Not IsNull(strEncryptedKey) Then
                                                            strProductName = "Adobe Acrobat " & strSubkey
                                                            strDecodedKey = DecodeAdobeSerialNumber(strEncryptedKey)
                                                            If Len(strVersionInfo) = 0 Then
                                                                  strVersionInfo = strProductName & "|" & strDecodedKey
                                                            Else
                                                                  strVersionInfo = strVersionInfo & "|" & strProductName & "|" & strDecodedKey
                                                            End If
                                                      End If
                                                Next
                                          End If
                                          arrDetails = Split(strVersionInfo, "|")
                                          For intItem = LBound(arrDetails) To (UBound(arrDetails) - 1) Step 2
                                                strProductName = arrDetails(intItem)
                                                strDecodedKey = arrDetails(intItem + 1)
                                                If objInstalled.Exists(strProductName) = False Then
                                                      objInstalled.Add strProductName, strDecodedKey
                                                Else
                                                      If objInstalled(strProductName) <> strDecodedKey Then objInstalled(strProductName) = objInstalled(strProductName) & "," & strDecodedKey
                                                End If
                                          Next
                              End Select
                        Next
                        
                        strKeyList = ""
                        For Each strProduct In objInstalled
                              If strKeyList = "" Then
                                    strKeyList = """" & strProduct & "," & objInstalled(strProduct) & """"
                              Else
                                    strKeyList = strKeyList & ",""" & strProduct & "," & objInstalled(strProduct) & """"
                              End If
                        Next
                        objResultsFile.WriteLine """" & strHostname & """,""" & strIPAddress & """,""" & strModel & """,""" & strSN & """," & strKeyList
                        'MsgBox strHostname & VbCrLf & strIPAddress & VbCrLf & strSN & VbCrLf & strModel & VbCrLf & strKeyList
                  Else
                        objNoContactFile.WriteLine strComputer
                        Err.Clear
                        On Error GoTo 0
                  End If
            Else
                  objNoContactFile.WriteLine strComputer
            End If
      End If
Wend
objInputFile.Close

WScript.Echo "Done. Please see " & strResultsFile

'Start the collection of the key, product name and also call the key decoder!
'***************************************************
Function GetOfficeKeys(strComputer, strKeyPath)
      strVersionInfo = ""
      'Go to the registery and collect the subkeys from initial key path
      Const HKEY_LOCAL_MACHINE = &H80000002
      Set oReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
      oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

      'Check to see if there is any subkeys, if not, do not run!
      If Not IsNull (arrSubkeys) Then
            For Each strSubkey In arrSubKeys
                  If Left(strSubkey, 1) = "{" Then
                        bDigitalProductID = Null
                        oReg.GetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & strSubkey, "DigitalProductId", bDigitalProductID
                        oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & strSubkey, "ProductName", strProductName
                        If Not IsNull(bDigitalProductID) Then
                              If IsNull(strProductName) Then strProductName = "{UNKNOWN in " & strKeyPath & "\" & strSubkey & "}"
                              strDecodedKey = DecodeOfficeKey(bDigitalProductID)
                              If Len(strVersionInfo) = 0 Then
                                    strVersionInfo = strProductName & "|" & strDecodedKey
                              Else
                                    strVersionInfo = strVersionInfo & "|" & strProductName & "|" & strDecodedKey
                              End If
                        End If
                  End If
            Next
      End If
      GetOfficeKeys = strVersionInfo
End Function

'This function decodes the key from the registry into something more useful!
Function DecodeOfficeKey(bProductIDArray)
      '***************************************************
      ' Located: http://www.tek-tips.com/viewthread.cfm?qid=1209546&page=1
      ' Original author stamp:
      '
      ' NAME: GetCDKeyandSerialNumber.vbs'
      ' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
      ' URL: http://www.thespidersparlor.com
      ' DATE  : 3/16/2006
      ' (C) 2006, All Rights Reserved'
      ' COMMENT:
      '*************************************************
      Const rpkOffset=52:i=28
      szPossibleChars="BCDFGHJKMPQRTVWXY2346789"
      Do 'Rep1
            dwAccumulator=0 : j=14
            Do
                  dwAccumulator=dwAccumulator*256
                  dwAccumulator=bProductIDArray(j+rpkOffset)+dwAccumulator
                  bProductIDArray(j+rpkOffset)=(dwAccumulator\24) and 255
                  dwAccumulator=dwAccumulator Mod 24
                  j=j-1
            Loop While j>=0
            i=i-1 : szProductKey=mid(szPossibleChars,dwAccumulator+1,1)&szProductKey
            if (((29-i) Mod 6)=0) and (i<>-1) then
                  i=i-1 : szProductKey="-"&szProductKey
            End If
      Loop While i>=0 'Goto Rep1
      DecodeOfficeKey=szProductKey
End Function

Function sGetWindowsKey(sComputer)  
      'Read the value of:
      'HKLM\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\DigitalProductId
      ' or if that returns BBBBB-BBBBB-BBBBB-BBBBB-BBBBB then read
      'HKLM\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\DigitalProductId4
      Dim bDigitalProductID
      Dim bProductKey()
      Dim ilByte
      Dim lDataLen
      Dim hKey
      Const HKEY_LOCAL_MACHINE = &H80000002
      
      Dim oReg
      Set oReg = GetObject("winmgmts:\\" & sComputer & "\root\default:StdRegProv")
      For Each sValueName In Array("DigitalProductId", "DigitalProductId4")
            sCDKey = ""
            oReg.GetBinaryValue HKEY_LOCAL_MACHINE, "SOFTWARE\MICROSOFT\Windows NT\CurrentVersion", sValueName, bDigitalProductID
            
            lDataLen = 164
            ReDim Preserve bDigitalProductID(lDataLen)
            ReDim Preserve bProductKey(14)
            
            For ilByte = 52 To 66
                  bProductKey(ilByte - 52) = bDigitalProductID(ilByte)
            Next
            
            'Now we are going to 'base24' decode the
            '   Product Key
            Dim bKeyChars
            bKeyChars = Array(Asc("B"),Asc("C"),Asc("D"),Asc("F"),Asc("G"),Asc("H"),Asc("J"),Asc("K"),Asc("M"),Asc("P"),Asc("Q"),Asc("R"),Asc("T"),Asc("V"),Asc("W"),Asc("X"),Asc("Y"),Asc("2"),Asc("3"),Asc("4"),Asc("5"),Asc("6"),Asc("7"),Asc("8"),Asc("9"))
            
            Dim nCur  
            Dim sCDKey
            Dim ilKeyByte
            Dim ilBit  
            
            Dim blnValid
            blnValid = False
            For ilByte = 24 To 0 Step -1
                  'Step through each character in the CD key
                  nCur = 0
                  
                  For ilKeyByte = 14 To 0 Step -1
                        'Step through each byte in the Product Key
                        nCur = nCur * 256 Xor bProductKey(ilKeyByte)
                        bProductKey(ilKeyByte) = Int(nCur / 24)
                        nCur = nCur Mod 24
                  Next
                  If bKeyChars(nCur) <> 66 Then blnValid = True
                  sCDKey = Chr(bKeyChars(nCur)) & sCDKey
                  If ilByte Mod 5 = 0 And ilByte <> 0 Then sCDKey = "-" & sCDKey
            Next
            If blnValid = True Then Exit For
      Next
      sGetWindowsKey = sCDKey
      
End Function

Function GetOSArchitecture(strComputer)
      Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
      Set colOS = objWMI.ExecQuery("SELECT AddressWidth FROM Win32_Processor",, 48)
    For Each objOS In colOS
        intAddressWidth = objOS.AddressWidth
    Next
    GetOSArchitecture = intAddressWidth
End Function

Function Ping(strComputer)
      Dim objShell, boolCode
      Set objShell = CreateObject("WScript.Shell")
      boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
      If boolCode = 0 Then
            Ping = True
      Else
            Ping = False
      End If
End Function

Function TimeNow(dDateTime)
      TimeNow =      Year(Now) & "-" &_
                        Right("00" & Month(Now), 2) & "-" &_
                        Right("00" & Day(Now), 2) & "-" &_
                        Right("00" & Hour(Now), 2) & "-" &_
                        Right("00" & Minute(Now), 2) & "-" &_
                        Right("00" & Second(Now), 2)
End Function

Function DecodeAdobeSerialNumber(strEncryptedKey)
      Dim strDecryptedKey, CipherIndex, i, strFormattedKey

      ' Adobe Substitution Cipher Key
      Dim AdobeSubCipherKey(24)
      AdobeSubCipherKey(0) = ""
      AdobeSubCipherKey(1) = "0000000001"
      AdobeSubCipherKey(2) = "5038647192"
      AdobeSubCipherKey(3) = "1426053789"
      AdobeSubCipherKey(4) = "2604371895"
      AdobeSubCipherKey(5) = "4753896210"
      AdobeSubCipherKey(6) = "8145962073"
      AdobeSubCipherKey(7) = "0319728564"
      AdobeSubCipherKey(8) = "7901235846"
      AdobeSubCipherKey(9) = "7901235846"
      AdobeSubCipherKey(10) = "0319728564"
      AdobeSubCipherKey(11) = "8145962073"
      AdobeSubCipherKey(12) = "4753896210"
      AdobeSubCipherKey(13) = "2604371895"
      AdobeSubCipherKey(14) = "1426053789"
      AdobeSubCipherKey(15) = "5038647192"
      AdobeSubCipherKey(16) = "3267408951"
      AdobeSubCipherKey(17) = "5038647192"
      AdobeSubCipherKey(18) = "2604371895"
      AdobeSubCipherKey(19) = "8145962073"
      AdobeSubCipherKey(20) = "7901235846"
      AdobeSubCipherKey(21) = "3267408951"
      AdobeSubCipherKey(22) = "1426053789"
      AdobeSubCipherKey(23) = "4753896210"
      AdobeSubCipherKey(24) = "0319728564"
      
      For i = 1 To 24
            CipherIndex = Cint(Mid(strEncryptedKey,i,1)) + 1
            strDecryptedKey = strDecryptedKey & Mid(AdobeSubCipherKey(i),CipherIndex,1)
      Next

      'Include dashes for readability
      strFormattedKey = Replace(Mid(strDecryptedKey,1,4) & "-" & Mid(strDecryptedKey,5,4) & "-" & Mid(strDecryptedKey,9,4) & "-" & Mid(strDecryptedKey,13,4) & "-" & Mid(strDecryptedKey,17,4) & "-" & Mid(strDecryptedKey,21,4),"-----","")
      
      DecodeAdobeSerialNumber = strFormattedKey
End Function
0
 

Author Closing Comment

by:WellingtonIS
Comment Utility
I found this script by searching this site.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now