Some applications have requirement that they expects/read some values/data from current users hive in registry and this data usually get added to the users registry during application installation. Now in XenApp, since the application will be installed on the single XenApp server so the data will be added to current user hive in registry for the administrator who will install it. Now when such application will be published for users and when users will try to run this application, this application might break or might not behave properly as it will try to read some data from the current users hive which is not present for that particular user.
To implement this requirement in XenApp, we have to write VBScript to write data into the current user registry hive.
Let me describe problem statement:
- User’s do not have rights to use “regedit” command. The only allowed way for user’s to write to their registry is by using RegWrite command.
- We need to write some value say “VALUE” to the key “Folder” at current user hive “HKEY_CURRENT_USER\Software\XYZ\ABC\11.1”
- We need to write “123456” to the key “aaa/bbb” at the current user hive “HKEY_CURRENT_USER\Software\XYZ\ABC”. Please note the forward slash in-between the key.
- Once above steps will be implemented, application should be launched.
Solution: Below VBScript is the solution. Let us discuss the solution of above four problems.
For first problem, where users are restricted rights, we have created function “WriteReg” which is taking key, value and type as input and executing RegWrite command to write the value into the registry.
For second problem, we are calling “WriteReg” function with the required parameters.
For third problem, we have to pass key with the format “\\\aaa/bbb”.
For forth problem, we have used notepad as an example.
Now in XenApp, we just need to publish this VBScript.
It can be published in XenApp as shown below:
Note: For more information on publishing in XenApp, refer to my article https://mdaslam.wordpress.com/2010/06/10/application-publish-in-xenapp/Advertisements