I am trying to use this script:

ProduKey.exe /windowskeys 1 /officekeys 1 /iekeys 0 /sqlkeys 0 /exchangekeys 0 /extractedition 1 /scomma keys.csv
cscript.exe keys.vbs

I keep receiving: Error 1 received while executing script

Any ideas? Do I need to Check Enabled? What do I need to run it as? I have dependencies Produkey.cfg; Produkey.exe and a .vbs file called keys with the following script:

Option Explicit

Dim objFSO   
Dim objTextFile
Dim winKey
Dim officeKey
Dim strFile
Dim arrKeys
Dim i

Const ForReading = 1
Const winCDLine = "Windows"
Const officeCDLine = "Microsoft Office"
Const noViso = "Visio"
Const officeKeyReg = "offKey"
Const winKeyReg = "winKey"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("keys.csv", ForReading)

'Read the file into the array
strFile = objTextFile.ReadAll
arrKeys = Split(strFile, vbCrLf)

For i = LBound(arrKeys) To UBound(arrKeys)
 'try to find the windows product key
  winKey = getKey(arrKeys(i))
  writeReg winKey,winKeyReg 
 End If
 'try to find the office product key
 If(InStr(arrKeys(i),noViso)) Then
 ElseIf(InStr(arrKeys(i),officeCDLine)) Then
  officeKey = getKey(arrKeys(i))
  writeReg officeKey,officeKeyReg
 End If

Function getKey(strKeyLine)
Dim temper
Const KeyLoc = 2
Const ProdLoc = 0

temper = Split(strkeyLine,",")
getKey = temper(prodloc) & "_" & temper(KeyLoc)

End function

Sub writeReg(strValue,StrValueName)

Dim strComputer
Dim oReg
Dim wshShell

Const HKEY_LOCAL_MACHINE = &H80000002
Const strKeyPath = "SOFTWARE\TVG"
Const strKeyPath64 = "SOFTWARE\Wow6432Node\TVG"
Const is64Key = "SOFTWARE\Wow6432Node"


Any help is appreciated! Also trying to push to Windows 7 machines. Thanks

0 Comments   [ + ] Show Comments


Please log in to comment



Does it run locally outside of Kace? I ask because the last four lines match the script where you copied it from. I would say without testing it that those keys do not exist on your machines, and you need to change them. DChristian works for the "The Vantage Group" which I'm assuming is why he named the keys "SOFTWARE\TVG".


Answered 05/22/2013 by: dugullett
Red Belt

  • It also doesn't look like you copied the entire script.
  • As asked above, does the .vbs work outside of the K1000? If so, you can use this to create a kscript with it: http://www.kace.com/support/resources/kb/article/how-to-call-a-visual-basic-script
  • At the risk of sounding like an idiot, I am having a brain cramp and cannot figure out how to run it locally. I apologize lol also when I run this script where will it populate the keys? Did I miss that in the script? thanks for your response

    By the way the reason I copied it is because I called Dell and their response to helping me find keys was to send me the link to IT Ninja.
    • I've never used the product, but I'm assuming you would change the directory to where the exe is located and start there.

      You might also want to take a look at that link again, and make sure you copy the entire script. It looks like you stopped halfway through.
  • i had copied the one i posted from a different link, but i changed it to the one from the link with no luck i am checking the directory now
  • I cannot get it to run outside of Kace. Theres is probably a lot of syntax problems but i am terrible with scripting and cannot figure out what the problem is. I am sure there is something I need to change or enter but I am just getting more and more confused as I look at it
    • break script into 2 scripts to trouble shoot

      Script 1 create the produkey export file in a temp area by using
      /scomma c:\windows\temp\keys.csv.

      If that works and creates the file, move on to script 2

      Script 2 use a modified version of your vbs to call the file.
      c:\windows\temp\keys.csv ForReading
      • if nothing else at that point you can open a command window and execute the vbs manually.
  • Well I just found out that this script I am using does not work for Windows 7. So I may be stuck unless someone else has a solution
    • what are you try to accomplish?
  • I would like to be able to pull Microsoft Office 2010 keys from our PCs using Kace. That is my ultimate goal
    • as a soiftware custom inventory?
      use produkey to create a txt file and then create a inventory item to read the txt file
      • http://www.itninja.com/blog/view/license-key-retreival-with-the-k1000-and-recoverkeys
Please log in to comment

Are you running this as an "Online Shell Script" inside KACE? If so make sure that this box is not set to ".sh".

Answered 05/22/2013 by: Ben M
Ninth Degree Black Belt

  • Yes I did change it to a .bat file. Thanks for your quick response
Please log in to comment

try a start /wait cscript.exe keys.vbs

It could be Produkey may not be done writing the file when the script is trying to read it.

Answered 05/22/2013 by: SMal.tmcc
Red Belt

  • this did run but it quickly closed, if it did save the keys i am not sure where
    • it would be in the same directory that the kace script ran from which goes away upon completion
Please log in to comment
Answer this question or Comment on this question for clarity