Dear Team,
I cant able to set user based environment variable.It set to the logged-in user instead of windows local user.
I have create a windows local user ".\localadmin" with appropiate rights but environment variable is set to the ".\administrator" which is logged-in user. I have tried in post-installation step also.
Could you please help me on this? iam using Installbuilder 20.12.0.
<addEnvironmentVariable>
<name>SISUITE_PORT</name>
<scope>user</scope>
<username>.\localadmin</username>
<value>1234</value>
<onErrorActionList>
<showInfo>
<text>error occured</text>
</showInfo>
</onErrorActionList>
</addEnvironmentVariable>
Hi @vimala1085,
Can you try <username>localadmin</username>:
<addEnvironmentVariable>
<name>SISUITE_PORT</name>
<scope>user</scope>
<username>localadmin</username>
<value>1234</value>
<onErrorActionList>
<showInfo>
<text>error occured</text>
</showInfo>
</onErrorActionList>
</addEnvironmentVariable>
Regards,
Michiel
I have tried "localadmin" , ".\localadmin" and "hostname\localadmin" eventhen it is not working. i already tried these options.
Is there any update on this
<registrySet>
<key>HKEY_Users\${SID}\Environment</key>
<name>SISUITE_PORT</name>
<value>1234</value>
</registrySet>
when i try to set environment variable using registryset command from administrator, i get "could not set registry key"
SID of localadmin is not exists ie the user which we are trying to set in registry is not there. only the SID of logged-in user is present. If i logged into the windows local user(localadmin) then only i can able to view that SID entry of the windows localadmin in the registry.
Is it the behaviour of windows?
I could not reply for the ServiceRequest SR 21208415103 as i dont have permission.
Thanks for your reply
Hi @vimala1085,
I've replied in private support but I will add it here as well so it can help other users. You could use wmic to get the SID of localadmin. For example:
<runProgram>
<program>wmic</program>
<programArguments>useraccount where name="localadmin" get sid</programArguments>
</runProgram>
<!-- we only want the actual SID from the wmic output -->
<setInstallerVariableFromRegEx>
<name>userSid</name>
<pattern>.*(S[0-9-]+).*</pattern>
<text>${program_stdout}</text>
<substitution>\1</substitution>
</setInstallerVariableFromRegEx>
<!-- use the variable in the registrySet action -->
<registrySet>
<key>HKEY_USERS\${userSid}\Environment</key>
<name>sisuite_test</name>
<type>REG_SZ</type>
<value>1234</value>
</registrySet>
Regards,
Michiel
As you suggested it is not working. If we try to set registry key of one user(windows local user) from another user then it could not set registry key.
Anyhow i am attaching the screenshot again. Then only you will come to know the exact issue.
Can you please try in your local machine by creating windows local user from your logged-in user(both users are different) and try to set registry key from your logged-in user to another user.