Set HKCU registry value based on logged on user
I am installing a program with PDQ Deploy. I need to add a registry value to HKCU\Software\(Program Name)\Config. The value name (/v) and the type (/t) are 'static', but the data (/d) chages depending on who is logged into the PC; "C:\Users\(Logged on user)\AppData\Local\(Program Name).....config. The install is licensed, so it will only be used by one user per machine. The user will have to be logged in when the package is deployed, but I need the "Logged on user" to be the logged-on user's username. I'm not sure if there's a wildcard (e.g. %USER%, %USERNAME%, [LogonUser], etc.) that can be used in this case. Is this possible?
0
Comments
Yes, there is a variable called %USERNAME%. If you need to have the domain name be part of the value then you could use %USERDOMAIN%\%USERNAME%. Make sure to have the condition set to Only Run If A User Is Logged On and change the Run As Option (for the registry step) to Run As Logged On User.
If you are on a domain, its better to use the group policy or a logon script which run in the user context. The deployments allways run under the deployers credentials if they are not specified differently. I am using something simmilar. Check the attachment.
Just to see if everything else worked correctly, I added a registry key with my username as the data path, with me logged into during the deployment. Unfortunately when I launch the program, I am still prompted to enter a license key. So I believe I'm missing something else.
I've successfully deployed the software to the PC, but there is a second executable that (without PDQ) is to be launched after the install. This executable pops up a window prompting the user to input the name of the license sever associated with that program. I did that on one PC and just installed the software on another. I went through the registry and found every instance of the server name that I could find and tried manually adding those to the other registry with PDQ to see if that would keep me/the other users from having to launch the second executable and enter in the server name. Unfortunately, even using PDQ to add those registry keys, I'm still prompted to enter in a license. I'm now wondering if it's possible to run a batch file that will automatically launch the executable and somehow enter in the necessary data...
I would suggest you contact your vendor and ask a for a silent installer.
There is however a possibility to use AutoIt https://www.autoitscript.com/site/autoit/, but you have to learn how to use it first.
Please sign in to leave a comment.