/build/static/layout/Breadcrumb_cap_w.png

Copy registry Value to another Key

Hi,

I have a package which (for licensing issues) needs to know the username who installed the app on the machine and place it in:

\\HKLM\Software\Eutech Technology\PEL\6\Name.

When the MSI is installed, I thought instead of prompting the User to enter User Name, I would just use a script to retrieve the user name logged on from:

\\HKCU\Software\Microsoft\Windows\Current Version\Explorer\Logon User Name.

And then put the value in:

\\HKLM\Software\Eutech Technology\PEL\6\Name.

Does anyone have a script that would do this?

Many thanks,

Mike.

0 Comments   [ + ] Show comments

Answers (3)

Posted by: Meic 17 years ago
Second Degree Blue Belt
0
I've managed to sort this out I think. If anyone is interested, here is the script:

Dim WshShell

Set WshShell = WScript.CreateObject("WScript.Shell")

vData = WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name")

WshShell. RegWrite"HKLM\SOFTWARE\Eutech Technology\PEL\6\Name", vData, "REG_SZ"


Cheers,

Mike.
Posted by: Drye 17 years ago
Senior Yellow Belt
0
Nice script, I will have to bookmark for future reference. Thanks
Posted by: anonymous_9363 17 years ago
Red Belt
0
No error-trapping, though...What are you going to do if the RegRead fails? Or the RegWrite? If you assume nothing will go wrong, it *will* return and bite your ass at some point.
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