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!
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
Answers (4)
Please log in to answer
Posted by:
andler
19 years ago
Posted by:
artiahc_elay
19 years ago
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
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
19 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.
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