locked
Dynamic scripts in App-V 5.0 sequences (SP1 or SP2) RRS feed

  • Question

  • I have successfully packaged an application in App-V 5.0 SP1 sequencer and delivered it to a Server 2008 R2 XenApp 6 server; it will run great locally on the server and within a hosted XenApp session.  The basic application functions as a client connecting to a back-end database.  The db server and db name are just registry entries in HKCU\Software\<app's key>

    The customer has 4 separate environments (TEST, DEV, CERT, PROD) that they want this client app to connect to.

    What I would like to accomplish is sequence the application one time, then dynamically inject the DB NAME and DB SERVER into the registry at application launch time.  Then publish the app as 4 separate links to each environment (whether through App-V or Citrix, doesn't matter in this instance), so only users with a specific link to that environment have access.  So far my attempts have been unsuccessful.  Here's where I'm at:

    - I created a simple batch file that adds the registry keys based on the %1 command switch (so for example to inject DEV: "LAUNCH.BAT" DEV).  The batch file by itself works just fine.  While sequencing I added this file under the app's install folder in %programfiles% and created shortcuts in the start menu for each environment.  Once published via App-V, however, the shortcuts wouldn't correctly call the script THEN the .exe.  It seemed the script wasn't running inside the virtual environment...

    I am still learning how the dynamic userconfig.xml scripting works...so currently I've been unable to come up with a theory on how to accomplish what I need.  Will App-V let me publish the same .appv package 4 separate times with different deploymentconfig.xml files?

    Thanks in advance for any help.  I've Binged (and Googled) for a couple days and read countless articles... I'm racking my brain on this and can't seem figure out the solution.

    Thursday, March 20, 2014 12:59 AM

Answers

  • No need to create a fancy script, because userconfig.xml is ideal for this situation. Create the package without the (or just the default) environment setting. Copy userconfig.xml 4 times, and open these xml's (I usually use ACE, which is a great tool to modify them, but notepad will do too).

    Assuming you want the same shortcut: Go to the Virtual registry section and enable it. Add your env. setting here. Create 4 AD-groups for each env. Go to your management console, add the package, add those 4 AD-groups, and apply on each group it's associated userconfig.xml.
    If you want to have each shortcut an other name, you can also modify it in the config.

    • Marked as answer by Cory Goffrier Friday, March 21, 2014 1:29 PM
    Thursday, March 20, 2014 8:50 AM

All replies

  • No need to create a fancy script, because userconfig.xml is ideal for this situation. Create the package without the (or just the default) environment setting. Copy userconfig.xml 4 times, and open these xml's (I usually use ACE, which is a great tool to modify them, but notepad will do too).

    Assuming you want the same shortcut: Go to the Virtual registry section and enable it. Add your env. setting here. Create 4 AD-groups for each env. Go to your management console, add the package, add those 4 AD-groups, and apply on each group it's associated userconfig.xml.
    If you want to have each shortcut an other name, you can also modify it in the config.

    • Marked as answer by Cory Goffrier Friday, March 21, 2014 1:29 PM
    Thursday, March 20, 2014 8:50 AM
  • Thanks, I will give that a shot!
    Thursday, March 20, 2014 1:22 PM
  • I'll say I've made progress but I don't know if this will work because I will need users to be able to access 1 or all of the 4 environments.  Here's what I've got so far:

    Created a separate userconfig.xml for the DEV and CERT environments (for testing), each one contains the correct registry entries as well as the .lnk file renamed to include the environment (just for visibility).

    If I log in with a user who is only a member of one of the AD groups the app runs correctly with the user configuration for that environment.

    When I log in with a user who is a member of both groups, it appears App-V is falling back to the default config from the deployment .xml; I suspect this because all of the .lnk files are the defaults and NOT the custom ones I defined in the user configurations.

    Have you encountered this before?  Does this sound like expected behavior?  I've re-checked both of my user configs and re-imported, verified each one works independently, but no joy with more than one group.

    Thursday, March 20, 2014 9:55 PM
  • Hmm I did not notice you wanted to have published both (or more) shortcuts to the same user... then you get indeed a conflict, because in that case 2 configs are applied to the same package, which app-v can't handle. App-v falls back to it's default config (if you browse to your publishing server from that client, like http://publishingserver, you will likely get an errormessage like "userconfiguration conflict=true".
    I've seen this issue a couple of times in our envirnoment, and I'm not sure if this is by design or not.
    The only solution is to create multiple AD-groups with combinations of shortcuts the user get's, so eventually he's only member of 1 ad-group (and it's corresponding userconfig.xml)

    Friday, March 21, 2014 12:28 PM
  • Thanks for all your input.  I'll still mark your original reply as an "answer" because it got me most of the way there and helped me greatly in understanding the dynamic config feature. :)  We'll see if I can make this work.

    Friday, March 21, 2014 1:29 PM