RunAsUser is a utility which can be used to run an executable or a batch script file in the user context when triggered from the system context. You can use this utility in custom batch scripts that run only in the system context.
Note: This utility runs only after user login. If triggered before user login, then the utility fails to run the desired script.
Prerequisites
Procedure
- ♦ Use the following syntax to run a script file in the user context when triggered from the system context: <utility path>\RunAsUser.exe <script path>\<script file>.bat <arg 1> <arg 2> … <arg n>
- <utility path> - location of the RunAsUser utility
By default, the utility is present at the location where App Volumes agent is installed.
- <script path>\<script file>.bat - location of the script file that you choose to run
- arg 1, arg 2, … arg n - (optional) parameters for running the script file.
- <utility path> - location of the RunAsUser utility
Example
OnPreEnableApp.bat is one of the custom script files that runs in the system context. If you want to run a script in the user context from within
OnPreEnableApp.bat, add the following syntax in
OnPreEnableApp.bat:
... %svagent%\RunAsUser.exe configuration.bat licensekey ...When OnPreEnableApp.bat is executed, the RunAsUser utility runs configuration.bat in the user context using the argument, licensekey.