Citrix WEM external tasks calling environmental va...
# citrix-wem
d
Citrix WEM external tasks calling environmental variables stopped working I've been using an external task in WEM for years to launch a bat file to update BGinfo. One of the values I'm displaying is client name. BGinfo is finicky and limited and has never been able to see the %clientname% variable, so a work around is to create a registry rule in WEM that creates a custom variable (HKCU\Environment\ClientNameCustom) with a value of %clientname%. Pointing BGinfo to that reg successfully pulls the current client name. Or it used to. Out of the blue, the BGinfo bat fired from a WEM external task has stopped being able to resolve the variable. It now just displays %clientname%. When I run the exact same bat directly on the session it works fine. (WEM is calling the bat from the VDA). As a potential workaround, I created a 1 line PS script to pull $env:clientname and write it to a text file, then pointed BGinfo to that text file for the client name. When the PS is fired from WEM, it does not write the variable to the text file. Running the same script directly on the VDA does. WEM external tasks run in the user context, so what the hell am I missing here??
s
it's strange. for the first case, you use the WEM registry action to write the registry entry and then run the external task to read it, right? Could you show the action configuration so we can test it on our local env? If you can provide the agent log file, it will be better.
For the second case, there is just one PS script to pull the env variable and run the BGinfo, right? Could you help to provide the PS script content so we can try it on our local env? thanks very much!
j
Try with the ##clientname## hashtag
👍 2
s
n
Somewhat related, but if you ever wanted to go a different route with BGInfo, give this a look: https://github.com/Mohrpheus78/Citrix/tree/main/BGInfo I had my own custom BGInfo config based on Dennis' original script and it worked out well.
❤️ 1
d
@James Kindon Thank you.....that did the trick. I'm not sure how I missed the hashtag/dynamic token functionality, but I surely did. (and I regularly read your blogs too!) Now I'll be pouring over our configs and filters seeing where I can leverage this. Thank you all for your responses.
j
Pleasure mate - glad you are sorted