Error 1 while scripting
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
If(instr(arrkeys(i),winCDLine))Then
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
Next
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
Answers (3)
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".
http://www.itninja.com/question/how-to-track-windows-and-office-product-keys#answer-58388
Comments:
-
It also doesn't look like you copied the entire script. - dugullett 11 years ago
-
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 - jknox 11 years ago
-
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. - bberry186 11 years ago-
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. - dugullett 11 years ago
-
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 - bberry186 11 years ago
-
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 - bberry186 11 years ago
-
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 - SMal.tmcc 11 years ago-
if nothing else at that point you can open a command window and execute the vbs manually. - SMal.tmcc 11 years ago
-
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 - bberry186 11 years ago
-
what are you try to accomplish? - SMal.tmcc 11 years ago
-
I would like to be able to pull Microsoft Office 2010 keys from our PCs using Kace. That is my ultimate goal - bberry186 11 years ago
-
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/question/how-to-upload-license-of-windows-into-kbox-inventory - SMal.tmcc 11 years ago-
http://www.itninja.com/blog/view/license-key-retreival-with-the-k1000-and-recoverkeys - SMal.tmcc 11 years ago
Are you running this as an "Online Shell Script" inside KACE? If so make sure that this box is not set to ".sh".
Comments:
-
Yes I did change it to a .bat file. Thanks for your quick response - bberry186 11 years ago
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.