DVation191
asked on
Use VBS script and WSHShell.RegWrite
A small project I am working on requires a silent installation of some software. For NAV2k5, it means no CD Key gets entered. I want a .vbs script I can run that prompts for the CD key, then merges the key to the registry.
This can be done with the info here ( http://www.winguides.com/scripting/library.php?id=6 ).
The key is...
[HKEY_LOCAL_MACHINE\SOFTWA RE\Symante c\CCPD-LC\ KStore\000 00082\0000 0002\00000 002]
"Key"="xxxxxxxxxxxxxxxxxxx xxxxx"
I need the .vbs script to prompt for the "xxxxxxxx"'s
Should be easy enough, I think...I don't know how to do it though. Any takers?
This can be done with the info here ( http://www.winguides.com/scripting/library.php?id=6 ).
The key is...
[HKEY_LOCAL_MACHINE\SOFTWA
"Key"="xxxxxxxxxxxxxxxxxxx
I need the .vbs script to prompt for the "xxxxxxxx"'s
Should be easy enough, I think...I don't know how to do it though. Any takers?
ASKER
looks good.
i'd do this myself if i could...but could you remove the valid cd key check? it isnt necessary because i want to be able to accept a variety of legit keys, and the application itself will check the validity of the key upon startup.
if you could do that i'd say this question is closed. thanks for your help.
i'd do this myself if i could...but could you remove the valid cd key check? it isnt necessary because i want to be able to accept a variety of legit keys, and the application itself will check the validity of the key upon startup.
if you could do that i'd say this question is closed. thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks. It's perfect!
' [HKEY_LOCAL_MACHINE\SOFTWA
' "Key"="xxxxxxxxxxxxxxxxxxx
' REF: http://www.winguides.com/scripting/library.php?id=6
Dim CDKEY
Dim WSHShell, RegKey, ScreenSaver, Result
CDKEY = InputBox("CD Key","Please enter the CD Key and press Ok. Press Cancel to Exit.","")
' keep asking till your CDKEY is valid or user exits.
While Not IsCDKeyValid(CDKEY)
CDKEY = InputBox("CD Key","Please enter a valid CD Key and press Ok.","")
wend
Set WSHShell = CreateObject("WScript.Shel
RegKey = "HKEY_LOCAL_MACHINE\SOFTWA
WSHShell.RegWrite regkey & "Key", CDKEY
Set WSHShell = Nothing
Msgbox("Done")
Function IsCDKeyValid(CDKEY)
CDKEY = Trim(CDKEY)
'enter validation functions here
If Len(CDKEY) = 0 Or Len(CDKEY) = 10 then
IsCDKeyValid = True
else
IsCDKeyValid = False
end if
End Function