/build/static/layout/Breadcrumb_cap_w.png

script to prompt for input and populate registry

On install, I want a custom action to launch a vbs and prompt the user to input some data. Then I want this data (an email address and later a phone number) to populate some registry keys.
I think this should be fairly easy to do... if I knew much VBS.. which I don't (I'm learning!).
Any help?
Thanks!

1 Comment   [ + ] Show comment
  • Hi,
    Sorry for bumping an old post but I have just found and tried this with the following results:
    1) as-is the script appears to create and populate registry keys and values under HKCU (even though the constant is named HKEY_LOCAL_MACHINE)
    2) if I change line 10 to:
    const HKEY_LOCAL_MACHINE = &H80000002
    and then run it again it runs OK but no keys and values appear in HKLM
    I'm not great with VBScripting - can anybody explain why this isn't working and suggest a solution.
    Thanks in Advance
    TGCS - TGCS 9 years ago

Answers (4)

Posted by: andler 18 years ago
Orange Belt
0
Hi turbokitty

In vbscript you have two dialogboxes, MsgBox and InputBox.
In your case you'll need to use the inputbox.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctinputbox.asp

br
andler
Posted by: turbokitty 18 years ago
6th Degree Black Belt
0
That gets me started.. thanks andler.
Posted by: artiahc_elay 18 years ago
Senior Yellow Belt
0
hey kitty,

Sorry I might be late, if iam not hope this helps


Set WshShell = WScript.CreateObject("WScript.Shell")
Input1 = InputBox("Enter E-mail address")
MsgBox ("You entered: " & Input1)
Input2 = InputBox("Enter Phone Number")
MsgBox ("You entered: " & Input2)


Set WshShell = CreateObject("WScript.Shell")
const HKEY_LOCAL_MACHINE = &H80000001
strComputer = "."
Set objReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Personal Info"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
WScript.Echo "Created registry key HKEY_LOCAL_MACHINE\SOFTWARE\Personal Info"


strValueName1 = "Email Address"
strValueName2 = "Phone Number"

objReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,_
strKeyPath,strValueName1,Input1
objReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,_
strKeyPath,strValueName2,Input2


this script creates a key called Personal Info under HKCU\SOFTWARE\ and also creates 2 values names email address and Phone number and populates the value data with user input. pretty simple eh ;-)

Regards,
Chaitra
Posted by: turbokitty 18 years ago
6th Degree Black Belt
0
Thank you! Yes, a bit late but it gives me some ideas for my next script. Cheers.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ