How can i use the Placeholder variables in files?
I have tried as following:
1. Set a new environment variable in UEM
2. Use the Placeholder in the file:
ln=[Flex#%ABX_USERNAME%]
exampleFilesCopied=true
lang=de
After the user logged on, the environment variable was set successfully with the value of the username. But the file ist still not OK. The Placeholder variable was not resolved and looks exactly the same as defined in predefined settings.
What i am doing wrong? Can someone please help me?
UEM 9.6, Horizon 7.6.0
Thanks, tschuegy
Hi tschuegy,
Yeah, given the sample content you provided, I wasn't sure whether this was a .INI file or a .props one 🙂
When importing predefined settings, Files and Folders settings, and Registry settings, the UEM agent will only process placeholders if the file name includes that [Flex#] marker. For .txt, .ini, and .xml files, the UEM Management Console will automatically scan whether they contain [Flex#%...] references, and update the file name if placeholders are found in the content.
Revisiting the documentation about this, I noticed that quite some relevant info is missing. I'll work with the docs team to address that. Sorry about that, and thank you for bringing this to my attention.
I've attached the relevant bit from the original documentation in the meantime.
Hi tschuegy,
The [Flex#%ABX_USERNAME%] reference that you're using is perfectly valid, so let's see what exactly is going on.
How are you creating the file, exactly? Using a Files and Folders setting on the User Environment tab, or via predefined settings?
I've tried both (creating a file on the desktop with the content from your example), and that works fine. My log file shows the following, respectively:
2019-03-11 13:28:49.561 [INFO ] Importing UEM settings 'ABX demo.zip' ([General]\FlexRepository\Settings\File\ABX demo.zip)
2019-03-11 13:28:49.562 [DEBUG] Placeholders: Found 1 placeholder in path 'Desktop/test[Flex#].ini'
2019-03-11 13:28:49.562 [DEBUG] Placeholders: Resolved to path 'Desktop/test.ini'
2019-03-11 13:28:49.562 [DEBUG] Placeholders: Placeholders will be replaced in file content using automatically detected code page
2019-03-11 13:28:49.562 [DEBUG] Placeholders: Found 1 placeholder in file 'Desktop/test[Flex#].ini'
2019-03-11 13:28:49.563 [DEBUG] Read 1 entry from profile archive (size: 60; compressed: 60; took 1 ms)
2019-03-11 13:28:49.563 [INFO ] Successfully imported settings ('ABX demo.xml')
and
2019-03-11 13:34:08.789 [DEBUG] Processing predefined settings definition
2019-03-11 13:34:08.789 [INFO ] No profile archive to import for config file '[General]\qweqweqweqwe.INI'
2019-03-11 13:34:08.791 [INFO ] Importing default settings 'qweqweqweqwe-UEM-PD-#1.zip' ([General]\qweqweqweqwe-UEM-PD-#1.zip)
2019-03-11 13:34:08.791 [DEBUG] Placeholders: Found 1 placeholder in path 'Desktop/test[Flex#].ini'
2019-03-11 13:34:08.791 [DEBUG] Placeholders: Resolved to path 'Desktop/test.ini'
2019-03-11 13:34:08.791 [DEBUG] Placeholders: Placeholders will be replaced in file content using automatically detected code page
2019-03-11 13:34:08.792 [DEBUG] Placeholders: Found 1 placeholder in file 'Desktop/test[Flex#].ini'
2019-03-11 13:34:08.792 [DEBUG] Read 1 entry from profile archive (size: 60; compressed: 60; took 1 ms)
What is the name (or at least, the extension) of the file you're trying to create? Can you share the UEM log file (at log level DEBUG)?
Hi UEMdev
Your input with the file extension target me in the right direction 🙂
It works with your described example Test.txt on the desktop.
Now, lets have a look what i tried:
Finally, we had to have a file called "leonardo_18.props". When i edit the predefined settings again, i can see that the *.txt file was renamed with [Flex#], but not the *.props file. Now, i have for a test manually created a new *.props file called "leonardo_18_2.props" and renamed this to "leonardo_18_2[Flex#].props" file. It works with the renamed filename.
Here are the debug log entries:
2019-03-11 15:48:35.324 [INFO ] No profile archive to import for config file '[general]\Applications\ABX demo.INI'
2019-03-11 15:48:35.325 [INFO ] Importing default settings 'ABX demo-UEM-PD-#1.zip' ([general]\Applications\ABX demo-UEM-PD-#1.zip)
2019-03-11 15:48:35.333 [DEBUG] Placeholders: Found 1 placeholder in path 'Desktop/Testfile[Flex#].txt'
2019-03-11 15:48:35.333 [DEBUG] Placeholders: Resolved to path 'Desktop/Testfile.txt'
2019-03-11 15:48:35.333 [DEBUG] Placeholders: Placeholders will be replaced in file content using automatically detected code page
2019-03-11 15:48:35.371 [DEBUG] Placeholders: Found 1 placeholder in file 'Desktop/Testfile[Flex#].txt'
2019-03-11 15:48:35.394 [DEBUG] Placeholders: Found 1 placeholder in path 'UserProfile/.leonardo/18/leonardo_18_2[Flex#].props'
2019-03-11 15:48:35.394 [DEBUG] Placeholders: Resolved to path 'UserProfile/.leonardo/18/leonardo_18_2.props'
2019-03-11 15:48:35.394 [DEBUG] Placeholders: Placeholders will be replaced in file content using automatically detected code page
2019-03-11 15:48:35.395 [DEBUG] Placeholders: Found 1 placeholder in file 'UserProfile/.leonardo/18/leonardo_18_2[Flex#].props'
2019-03-11 15:48:35.401 [DEBUG] Placeholders: Found 1 placeholder in path 'UserProfile/.leonardo/18/TestFiles2[Flex#].txt'
2019-03-11 15:48:35.402 [DEBUG] Placeholders: Resolved to path 'UserProfile/.leonardo/18/TestFiles2.txt'
2019-03-11 15:48:35.402 [DEBUG] Placeholders: Placeholders will be replaced in file content using automatically detected code page
2019-03-11 15:48:35.404 [DEBUG] Placeholders: Found 1 placeholder in file 'UserProfile/.leonardo/18/TestFiles2[Flex#].txt'
2019-03-11 15:48:35.407 [DEBUG] Read 4 entries from profile archive (size: 240; compressed: 236; took 74 ms; largest file: 60 bytes; slowest import took 2 ms)
Why does it not work with every file extension?
Thx, tschuegy
Hi tschuegy,
Yeah, given the sample content you provided, I wasn't sure whether this was a .INI file or a .props one 🙂
When importing predefined settings, Files and Folders settings, and Registry settings, the UEM agent will only process placeholders if the file name includes that [Flex#] marker. For .txt, .ini, and .xml files, the UEM Management Console will automatically scan whether they contain [Flex#%...] references, and update the file name if placeholders are found in the content.
Revisiting the documentation about this, I noticed that quite some relevant info is missing. I'll work with the docs team to address that. Sorry about that, and thank you for bringing this to my attention.
I've attached the relevant bit from the original documentation in the meantime.