mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Retrieve Windows Product Key

Change Page: < 123 > | Showing page 2 of 3, messages 21 to 40 of 45
Author Message
ebgreen

  • Total Posts : 8088
  • Scores: 95
  • Reward points : 0
  • Joined: 7/12/2005
  • Status: offline
RE: Retrieve Windows Product Key Thursday, December 13, 2007 2:37 AM (permalink)
0
Try commenting out the On Error Resume Next that is on line 93 and see if you get errors.
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
#21
    dedwards2

    • Total Posts : 5
    • Scores: 0
    • Reward points : 0
    • Joined: 12/12/2007
    • Status: offline
    RE: Retrieve Windows Product Key Thursday, December 13, 2007 3:46 AM (permalink)
    0
    Negative, commenting out the 'on error resume next' on line 93 generates no errors.
     
    Double-clicking the script opens an IE window that says 'Please Wait....' and just sits there. I still see wscript.exe running.
     
    I feel like I'm doing something fundamentally stupid - maybe I'm missing a place in the script where I need to fill in my domain name or something.
     
    Let's say I had 200 computers in AD, and 50 of those were unreachable. How long should this script take to complete? Maybe I just need to leave it running all day. :D
    #22
      dedwards2

      • Total Posts : 5
      • Scores: 0
      • Reward points : 0
      • Joined: 12/12/2007
      • Status: offline
      RE: Retrieve Windows Product Key Thursday, December 13, 2007 4:31 AM (permalink)
      0
      OK!

      About ~45 minutes after double-clicking the VBS file, I get the following WSH error:

      Script: C:\Documents and Settings\username\Desktop\get_product_ID.vbs
      Line: 99
      Char: 1
      Error: The remote server machine does not exist or is unavailable: 'GetObject'
      Code: 800A01CE
      Source Microsoft VBScript runtime error


      Here's line 99:
       Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
          strComputer & "\root\default:StdRegProv")
       
      #23
        ebgreen

        • Total Posts : 8088
        • Scores: 95
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        RE: Retrieve Windows Product Key Thursday, December 13, 2007 4:45 AM (permalink)
        0
        Ok, so it sounds like it is running but you are just getting impatient.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
        #24
          dedwards2

          • Total Posts : 5
          • Scores: 0
          • Reward points : 0
          • Joined: 12/12/2007
          • Status: offline
          RE: Retrieve Windows Product Key Thursday, December 13, 2007 4:54 AM (permalink)
          0
          Hurry up and wait, roger that! :D
           
          Thanks for all the feedback; I will uncomment the On Error line and just let it run all day.
           
          Am I correct in reading that error message as "I can't ping this machine"? And the point of the On Error Next Resume in this loop is to keep the script running when it gets the "can't ping this machine" error?
          #25
            NewLeafIT

            • Total Posts : 6
            • Scores: 0
            • Reward points : 0
            • Joined: 1/7/2008
            • Status: offline
            RE: Retrieve Windows Product Key Monday, January 07, 2008 7:27 AM (permalink)
            0
            I am a noob to VBS and the related languages (my experience is more in Shell/Bash/PHP/Perl) so please bear with my ignorance...
             
            I have been trying some of the scripts in this post, and they appear to work well for many of my machines.  I'm using the HTA version now but the older machines running Office 2000 are not working.  It's failing to retrieve the information for MS Office, and returns only the OS info.  I modified the script to include 2000, but I must have done something wrong. 
             
            I edited Line 23 and added a new element to the array (lines 36 & 37).  Here's my code.  Could someone please tell me what I am missing?
             
            Thanks...
             
             <html>
             <head>
             <title>Microsoft Product Key Retrieval</title>
             <hta:application
             applicationname="MSKeyRetrieval" 
             caption="MSKeyRetrieval"
             contextmenu="no"
             maximizebutton="no"
             minimizebutton="yes"
             navigable="yes"
             showintaskbar="yes"
             singleinstance="yes"
             sysmenu="yes"
             >
             </head>
             <script language="VBScript">
             Const HKEY_LOCAL_MACHINE = &H80000002
             Const SEARCH_KEY = "DigitalProductID"
             Dim foundKeys
             Dim iValues
             Dim arrDPID
             Dim strHTML
             Dim arrSubKeys(5,1)
             foundKeys = Array()
             iValues = Array()
             arrSubKeys(0,0) = "Microsoft Windows"
             arrSubKeys(0,1) = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
             arrSubKeys(2,0) = "Microsoft Office XP"
             arrSubKeys(2,1) = "SOFTWARE\Microsoft\Office\10.0\Registration"
             arrSubKeys(1,0) = "Microsoft Office 2003"
             arrSubKeys(1,1) = "SOFTWARE\Microsoft\Office\11.0\Registration"
             arrSubKeys(3,0) = "Microsoft Office 2007"
             arrSubKeys(3,1) = "SOFTWARE\Microsoft\Office\12.0\Registration"
             arrSubKeys(4,0) = "Microsoft Exchange Product Key"
             arrSubKeys(4,1) = "SOFTWARE\Microsoft\Exchange\Setup"
             arrSubKeys(5,0) = "Microsoft Office 2000"
             arrSubKeys(5,1) = "SOFTWARE\Microsoft\Office\9.0\Registration"
             Sub window_onload
             ' <--------------- Set window Size --------------->
                    strComputer = "."
                    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
                    Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
                    For Each objItem in colItems
                        intHorizontal = objItem.ScreenWidth
                        intVertical = objItem.ScreenHeight
                    Next
                    intLeft = (intHorizontal - 500) / 2
                    intTop = (intVertical - 600) / 2
                    window.resizeTo 500,600
                    window.moveTo intLeft, intTop
              
             ' <--------------- Open Registry Key and populate binary data into an array -------------------------->
             strComputer = "."
             Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
             For x = LBound(arrSubKeys, 1) To UBound(arrSubKeys, 1)
              oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1), SEARCH_KEY, arrDPIDBytes
              If Not IsNull(arrDPIDBytes) Then
               call decodeKey(arrDPIDBytes, arrSubKeys(x,0))
              Else
               oReg.EnumKey HKEY_LOCAL_MACHINE, arrSubKeys(x,1), arrGUIDKeys
               If Not IsNull(arrGUIDKeys) Then
                For Each GUIDKey In arrGUIDKeys
                 oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1) & "\" & GUIDKey, SEARCH_KEY, arrDPIDBytes
                 If Not IsNull(arrDPIDBytes) Then
                  call decodeKey(arrDPIDBytes, arrSubKeys(x,0))
                 End If
                Next
               End If
              End If
             Next
             If IsNull(foundkeys) Then
              DataArea.InnerHTML = "No Keys Found" 
             Else
              DataArea.InnerHTML = strHTML
             End If 
             End Sub
             ' <----------------------- Return the Product Key ------------------------>
             Function decodeKey(iValues, strProduct)
             Dim arrDPID
             arrDPID = Array()
             ' <--------------- extract bytes 52-66 of the DPID -------------------------->
             For i = 52 to 66
              ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
              arrDPID( UBound(arrDPID) ) = iValues(i)
             Next
             ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->
             Dim arrChars
             arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
             ' <--------------- The clever bit !!! (decode the base24 encoded binary data)-------------------------->
             For i = 24 To 0 Step -1
              k = 0
              For j = 14 To 0 Step -1
               k = k * 256 Xor arrDPID(j)
               arrDPID(j) = Int(k / 24)
               k = k Mod 24
              Next
              strProductKey = arrChars(k) & strProductKey
              If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
             Next
             ReDim Preserve foundKeys( UBound(foundKeys) + 1 )
             foundKeys( UBound(foundKeys) ) = strProductKey
             If strProduct = "Microsoft Windows" Then
              strComputer = "."
              Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
              Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
              For Each objOperatingSystem in colOperatingSystems
               strOS = objOperatingSystem.Caption
              Next
              strHTML = strHTML & "<h3>" & strOS & "</h3>" & _
                "<h4>" & strProductKey & "</h4><br /><hr /><br />"
             Else
              strHTML = strHTML & "<h3>" & strProduct & "</h3>" & _
                "<h4>" & strProductKey & "</h4><br /><hr /><br />"
             End If
             End Function
             </script>
             <body>
             <div id="header" style="color:#ffffff; height:100px; text-align:center; font-family:Tahoma;
              filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#0011aa', EndColorStr='#ffffff')">
              <br /><h2>Retrieved Microsoft Product Keys</h2>
             </div><hr />
             <span id="DataArea"></span>
             <br />
             <div id="Print" style="text-align:center;"><input type="button" value="Print" Onclick="print()" ;></div>
             </body>
             </html>
             
             

             
             
            #26
              ebgreen

              • Total Posts : 8088
              • Scores: 95
              • Reward points : 0
              • Joined: 7/12/2005
              • Status: offline
              RE: Retrieve Windows Product Key Monday, January 07, 2008 7:33 AM (permalink)
              0
              I don't have a machine with Office 2000 on it to check, but are you sure that the registration information Office 2k is at that registry path?
              "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
              Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
              http://www.visualbasicscript.com/m_47117/tm.htm
              #27
                NewLeafIT

                • Total Posts : 6
                • Scores: 0
                • Reward points : 0
                • Joined: 1/7/2008
                • Status: offline
                RE: Retrieve Windows Product Key Monday, January 07, 2008 7:56 AM (permalink)
                0
                I'm waiting on a regedit screenshot off an XP machine running office 2000.  In the mean time, I can tell you that the "DigitalProductID" is directly under "Registration", and not under a GUID subfolder.  I'm thinking that is the culprit...
                #28
                  NewLeafIT

                  • Total Posts : 6
                  • Scores: 0
                  • Reward points : 0
                  • Joined: 1/7/2008
                  • Status: offline
                  RE: Retrieve Windows Product Key Monday, January 07, 2008 8:00 AM (permalink)
                  0
                  In fact, we have some users that have even older versions of office installed, and they don't have the GUID folder either.
                  #29
                    ebgreen

                    • Total Posts : 8088
                    • Scores: 95
                    • Reward points : 0
                    • Joined: 7/12/2005
                    • Status: offline
                    RE: Retrieve Windows Product Key Monday, January 07, 2008 8:03 AM (permalink)
                    0
                    Sounds like you have some modifications ahead of you.  
                    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
                    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
                    http://www.visualbasicscript.com/m_47117/tm.htm
                    #30
                      NewLeafIT

                      • Total Posts : 6
                      • Scores: 0
                      • Reward points : 0
                      • Joined: 1/7/2008
                      • Status: offline
                      RE: Retrieve Windows Product Key Monday, January 07, 2008 8:18 AM (permalink)
                      0
                      The script looks to me like it always assumes that there is a GUID folder.  But I could be misreading it... Either way, I'm not experienced enough with VBS to even determine that for sure, much less re-write the code.  There is a lot of syntax mixed in that is unfamiliar to me. The GUID logic is in the "ELSE" portion of an IF statement, so for all I know, the initial IF is determining if there is no GUID folder.  If that is the case, then the logic is already there and is just not working.  Otherwise, I'm totally off the mark.
                       
                      Anyway, I'm hoping someone on here can offer some more specific suggestions of code changes to try.
                       
                      #31
                        ebgreen

                        • Total Posts : 8088
                        • Scores: 95
                        • Reward points : 0
                        • Joined: 7/12/2005
                        • Status: offline
                        RE: Retrieve Windows Product Key Monday, January 07, 2008 8:26 AM (permalink)
                        0
                        Looks like it looks at every subkey under to product root key (i.e. every subkey under SOFTWARE\Microsoft\Office\10.0\Registration for Office XP). In each subkey it looks for a value named DigitalProductID. You will need to find out how Office 2k differs from this.
                        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
                        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
                        http://www.visualbasicscript.com/m_47117/tm.htm
                        #32
                          NewLeafIT

                          • Total Posts : 6
                          • Scores: 0
                          • Reward points : 0
                          • Joined: 1/7/2008
                          • Status: offline
                          RE: Retrieve Windows Product Key Monday, January 07, 2008 9:02 AM (permalink)
                          0
                          Ok.  This doesn't look good.  I'm going to double check this on a different machine.
                           
                          The location is still the same, but there does not seem to be a value in the DigitalProductID key.  Here's a dump from the entire "Registration" tree:
                           
                          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Registration]
                          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Registration\DigitalProductID]
                          @=""
                          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Registration\ProductID]
                          @="08706-OEM-0086151-38750"
                          #33
                            ebgreen

                            • Total Posts : 8088
                            • Scores: 95
                            • Reward points : 0
                            • Joined: 7/12/2005
                            • Status: offline
                            RE: Retrieve Windows Product Key Monday, January 07, 2008 9:31 AM (permalink)
                            0
                            So it looks like maybe the info is in ProductID for 2k?
                            "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
                            Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
                            http://www.visualbasicscript.com/m_47117/tm.htm
                            #34
                              NewLeafIT

                              • Total Posts : 6
                              • Scores: 0
                              • Reward points : 0
                              • Joined: 1/7/2008
                              • Status: offline
                              RE: Retrieve Windows Product Key Monday, January 07, 2008 9:56 AM (permalink)
                              0
                              I tried tweaking the script to look under ProductID, with no luck.
                               
                              After some extensive research, reading Help files for stand-alone key finder apps and whatnot, everywhere I'm looking is saying that Office 2000 does not store the key and the key cannot be retrieved.  This is beautiful, since the majority of the machines at our office have office 2000...
                               
                              So, if anyone can find anything to the contrary, please advise.  I would REALLY love to be able to automate the key retrieval for asset management.  But, if not, I guess that's life!
                               
                              Thanks, all
                              #35
                                Parabellum

                                • Total Posts : 233
                                • Scores: 0
                                • Reward points : 0
                                • Joined: 11/12/2006
                                • Location: UK
                                • Status: offline
                                RE: Retrieve Windows Product Key Friday, January 18, 2008 3:48 AM (permalink)
                                0
                                sorry, i haven't checked this for a while.
                                Sorry to say... the reason I didn't add support for office 2000 is because you can't retrieve the key from the registry for office 2000
                                It is only in versions XP or later that micrsoft started storing the key in this way.
                                I haven't yet found any tool... vbs or other that can retrieve a 2000 key.
                                If you know of one, let me know and i will try and find out how it works and see if I can modify the script to add this feature.
                                hope this answere your question.
                                 
                                P
                                #36
                                  hickory420

                                  • Total Posts : 2
                                  • Scores: 0
                                  • Reward points : 0
                                  • Joined: 9/2/2008
                                  • Status: offline
                                  RE: Retrieve Windows Product Key Tuesday, September 02, 2008 2:58 PM (permalink)
                                  0
                                  Hi Guys!

                                  Parabellum, I have to say, Very well done with your script. It's exactly what i've been looking for! Legend!

                                  But I have a slight hiccup... I have integrated your script with one from microsofts TechNet website and now I am getting a Syntax Error on Line 102 Character 1

                                  That line is: Function decodeKey(iValues, strProduct)



                                  I am pretty good at vbs, but this one threw me in for quite a loop..... I don't know how to fix it.

                                  It honestly makes no sence at all because essentially all I am doing is pinging each computer and if it replys it runs the keycheck script against that machine then dumps it to a file,
                                  then moves on to the next one. Why Syntax Error? It a Function!

                                  Can you make heads or tails of this?

                                  Thanks to Any/Everyone in advance!

                                   On Error Resume Next
                                   
                                   Const WbemAuthenticationLevelPktPrivacy = 6
                                   
                                   strCredentials = InputBox _
                                      ("Please enter the user name, a blank space, and then the password:", _
                                      "Enter User Credentials")
                                   
                                   If strCredentials = "" Then
                                      Wscript.Echo "Username and password must be provided. Now quitting."
                                      Wscript.Quit
                                      End If
                                   
                                      arrCredentials = Split(strCredentials," ")
                                      strUser = arrCredentials(0)
                                      strPassword = arrCredentials(1)
                                   
                                   strSubnetInput = InputBox("Enter the SubNet of the network you wish to scan." & VbCrLf &_
                                   VbCrLf & " Example: 192.168.xx.1")
                                   
                                   intStartingAddressInput = InputBox("Enter the starting address of the ping scan." & VbCrLf &_
                                   VbCrLf & "Example: 192.168." & strSubnetInput & ".1-254")
                                   
                                   intEndingAddressInput = InputBox("Enter the ending address of the Ping scan" & VbCrLf &_
                                   VbCrLf & "Example: 192.168." & strSubnetInput & "." & intStartingAddressInput & "-255")
                                   
                                   strSubnet = "192.168."& strSubnetInput &"."
                                   
                                   For i = intStartingAddressInput to intEndingAddressInput
                                      strComputer = strSubnet & i
                                   
                                      Set objShell = CreateObject("WScript.Shell")
                                      strCommand = "%comspec% /c ping -n 1 -w 200 " & strComputer & ""
                                      Set objExecObject = objShell.Exec(strCommand)
                                   
                                      Do While Not objExecObject.StdOut.AtEndOfStream
                                          strText = objExecObject.StdOut.ReadAll()
                                          If Instr(strText, "Reply") > 0 Then
                                   Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
                                      Set objWMIService = objwbemLocator.ConnectServer _
                                      (strComputer, strNamespace, strUser, strPassword)
                                      objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
                                   
                                      Set objFileSys = CreateObject ("Scripting.FileSystemObject")  
                                   logfile = "PingPong." & strSubnetInput & ".txt"
                                   Set filetemp = objFileSys.OpenTextFile(logfile, 8, True)
                                      filetemp.Write strComputer & " Ping... Pong"
                                      filetemp.Write VbCrLf
                                      filetemp.Close
                                   '===============================================================
                                   '  ##############################################################
                                   '  #        #
                                   '  # VBScript to retrieve Microsoft Product Keys  #
                                   '  # from the registry by decoding DigitalProductID's #
                                   '  #        #
                                   '  # -------------------------------------------------- #
                                   '  # Created by: Parabellum     #
                                   '  #        #
                                   '  ##############################################################
                                   '
                                   CONST HKEY_LOCAL_MACHINE = &H80000002
                                   CONST SEARCH_KEY = "DigitalProductID"
                                   Dim arrSubKeys(4,1)
                                   Dim foundKeys
                                   Dim iValues, arrDPID
                                   foundKeys = Array()
                                   iValues = Array()
                                   arrSubKeys(0,0) = "Microsoft Windows Product Key"
                                   arrSubKeys(0,1) = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
                                   arrSubKeys(2,0) = "Microsoft Office XP"
                                   arrSubKeys(2,1) = "SOFTWARE\Microsoft\Office\10.0\Registration"
                                   arrSubKeys(1,0) = "Microsoft Office 2003"
                                   arrSubKeys(1,1) = "SOFTWARE\Microsoft\Office\11.0\Registration"
                                   arrSubKeys(3,0) = "Microsoft Office 2007"
                                   arrSubKeys(3,1) = "SOFTWARE\Microsoft\Office\12.0\Registration"
                                   arrSubKeys(4,0) = "Microsoft Exchange Product Key"
                                   arrSubKeys(4,1) = "SOFTWARE\Microsoft\Exchange\Setup"
                                   
                                   ' <--------------- Open Registry Key and populate binary data into an array -------------------------->
                                   
                                   Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
                                   
                                   For x = LBound(arrSubKeys, 1) To UBound(arrSubKeys, 1)
                                   oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1), SEARCH_KEY, arrDPIDBytes
                                   If Not IsNull(arrDPIDBytes) Then
                                   call decodeKey(arrDPIDBytes, arrSubKeys(x,0))
                                   Else
                                   oReg.EnumKey HKEY_LOCAL_MACHINE, arrSubKeys(x,1), arrGUIDKeys
                                   If Not IsNull(arrGUIDKeys) Then
                                    For Each GUIDKey In arrGUIDKeys
                                     oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1) & "\" & GUIDKey, SEARCH_KEY, arrDPIDBytes
                                     If Not IsNull(arrDPIDBytes) Then
                                      call decodeKey(arrDPIDBytes, arrSubKeys(x,0))
                                     End If
                                    Next
                                   End If
                                   End If
                                   Next
                                   MsgBox("Finished")
                                   
                                   ' <----------------------------------------- Return the Product Key --------------------------------------------------->
                                   Function decodeKey(iValues, strProduct)
                                   
                                   Dim arrDPID
                                   arrDPID = Array()
                                   
                                   ' <--------------- extract bytes 52-66 of the DPID -------------------------->
                                   For i = 52 to 66
                                   ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
                                   arrDPID( UBound(arrDPID) ) = iValues(i)
                                   Next
                                   
                                   ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->
                                   Dim arrChars
                                   arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
                                   
                                   ' <--------------- The clever bit !!! (decode the base24 encoded binary data)-------------------------->
                                   For i = 24 To 0 Step -1
                                   k = 0
                                   For j = 14 To 0 Step -1
                                    k = k * 256 Xor arrDPID(j)
                                    arrDPID(j) = Int(k / 24)
                                    k = k Mod 24
                                   Next
                                   strProductKey = arrChars(k) & strProductKey
                                   If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
                                   Next
                                   
                                   ReDim Preserve foundKeys( UBound(foundKeys) + 1 )
                                   foundKeys( UBound(foundKeys) ) = strProductKey
                                   strKey = UBound(foundKeys)
                                   
                                   Set objFileSys = CreateObject ("Scripting.FileSystemObject")  
                                   logfile = "PC-Info.txt"
                                   Set filetemp = objFileSys.OpenTextFile(logfile, 8, True)
                                      filetemp.Write strComputer
                                      filetemp.Write strProduct & vbNewLine & foundKeys(strKey) & vbNewLine 
                                      filetemp.Write VbCrLf
                                      filetemp.Close
                                   
                                   End Function
                                   ' =====================================================================
                                   Else
                                   Set objFileSys = CreateObject ("Scripting.FileSystemObject")  
                                   logfile = "PingPong." & strSubnetInput & ".txt"
                                   Set filetemp = objFileSys.OpenTextFile(logfile, 8, True)
                                      filetemp.Write strComputer & " Ping..."
                                      filetemp.Write VbCrLf
                                      filetemp.Close
                                   End If
                                   Loop
                                   Next
                                   
                                  <message edited by hickory420 on Tuesday, September 02, 2008 5:01 PM>
                                  #37
                                    mbouchard

                                    • Total Posts : 2110
                                    • Scores: 27
                                    • Reward points : 0
                                    • Joined: 5/15/2003
                                    • Location: USA
                                    • Status: offline
                                    RE: Retrieve Windows Product Key Wednesday, September 03, 2008 2:08 AM (permalink)
                                    0
                                    Try moving the function outside of the If else then.  As soon as I did that I stopped getting a syntax error message in PrimalScript
                                    Mike

                                    For useful Scripting links see the Read Me First stickey!

                                    Always remember Search is your friend.
                                    #38
                                      p0ng

                                      • Total Posts : 46
                                      • Scores: 0
                                      • Reward points : 0
                                      • Joined: 6/18/2008
                                      • Status: offline
                                      RE: Retrieve Windows Product Key Wednesday, September 03, 2008 7:05 AM (permalink)
                                      0
                                      Very nice Parabellum

                                      Now your next task should be to create an HTA to change the registered keys.
                                      #39
                                        hickory420

                                        • Total Posts : 2
                                        • Scores: 0
                                        • Reward points : 0
                                        • Joined: 9/2/2008
                                        • Status: offline
                                        RE: Retrieve Windows Product Key Wednesday, September 03, 2008 3:12 PM (permalink)
                                        0
                                        Thanks for that, mbouchard. When I moved it out of the if else then statements, I stopped getting the syntax error as well! But I do get a different error :-P , Name Redifined.

                                        The line is it complaining about is "Dim iValues, arrDPID". I put the Function right above the first For statement "For i = intStartingAddressInput to intEndingAddressInput"

                                        I was actually happy that I got a different error message. sad isn't it....
                                        Don't get me wrong, I will be Cheering once the script is working and I will post the final product to share with everyone because you guys rock!

                                        again.
                                        #40

                                          Online Bookmarks Sharing: Share/Bookmark
                                          Change Page: < 123 > | Showing page 2 of 3, messages 21 to 40 of 45

                                          Jump to:

                                          Current active users

                                          There are 0 members and 2 guests.

                                          Icon Legend and Permission

                                          • New Messages
                                          • No New Messages
                                          • Hot Topic w/ New Messages
                                          • Hot Topic w/o New Messages
                                          • Locked w/ New Messages
                                          • Locked w/o New Messages
                                          • Read Message
                                          • Post New Thread
                                          • Reply to message
                                          • Post New Poll
                                          • Submit Vote
                                          • Post reward post
                                          • Delete my own posts
                                          • Delete my own threads
                                          • Rate post

                                          2000-2012 ASPPlayground.NET Forum Version 3.8
                                          mbt shoes www.wileywilson.com