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,

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


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"


Answered 07/05/2007 by: Meic
Second Degree Blue Belt

Please log in to comment
Nice script, I will have to bookmark for future reference. Thanks
Answered 10/05/2007 by: Drye
Senior Yellow Belt

Please log in to comment
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.
Answered 10/08/2007 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity