Basically you need to map the machine to a user, is that correct?
Has this username already logged at least once on the machine where you try to deploy the package?
Is this machine used by several users with different username?
Just need to understand better the situation to find a way to reach your goal.
The requirement is that the string '\\servername\share\%username%' is entered 'as is' - ie, without the %username% being expanded into a value.
When installing from the command line, the ^ character is used to prevent %username% being exanded to a username value. The ^ is an escape character and when it is added before a command symbol it allows it to be treated as ordinary text
For example, try these two dos commands with the output from the 2nd giving the desired result.
- echo \\servername\share\%username%
- echo \\servername\share\%^username%
The software is deployed during OS Provisioning so no user has logged on to the machine and it is not known which user(s) are going to use the computer.
In the Microsoft documentation it references how to deploy from the Command Line, Batch File, and SCCM
See the section "To Deploy the UE-V Agent" in https://technet.microsoft.com/library/dn458891.aspx#Agent
I did the test and I understand the dilemma. You would expect %^username% replaced by %username% instead of a value coming from the inventory.
Did you try with %^username^% ?
What kind of provision action did you use to apply the command line; AgentSetup.exe.....?
Maybe attach an export of this provision template to understand the context as well?
Something as well which pops in my mind but really this is a shot; why not using a public variable defined in the provision part of the LDMS console. You could define a search value called "TestMark" with a replace value "%username%".
and you would put the command line;
AgentSetup.exe /quiet /norestart SettingsStoragePath=\\server\share\%TestMark%
It looks a bit twisted but why not unless you have already tested it?
Try using %%username%%. That is the proper substitution in LANDesk provisioning.
This is correct for an environment variables Catalysttgj. But as the MarkEllis told, "Using a double %% results in the variable being expanding in to the Username variable, which is the computer hostname as the job is run under the system account"
To also add to my previous comments, I suppose you want to add this command in a registry key like RunOnce (If my memory correct), meaning when the user will login for the first time, it will add this agent this specific user? Am I correct?
All, thanks for the suggestions.
I've worked around the problem by executing a .cmd file that contains the installation command line using %%^username%%
AgentSetup.exe /passive /norestart SettingsStoragePath=\\servername\share\%%^username%%
The installation does write the SettingStoragePath value to the registry (HKLM\SOFTWARE\Microsoft\UEV\Agent\Configuration) so I could have added another task to replace the value but it's not a good solution.
I will try the public variable approach, but for now the .cmd file method works.
And this all brings up a very good point.. if you ever needed to pass double percents through to something, you would have to put four of them together! %%%% would end up as %% at the command shell level. Why in the world that would ever come up, but that's how it would work if it did. :-)