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

For an understanding of how batch script files are used in the App Volumes workflow and for a list of custom batch scripts, see Batch Scripts for App Volumes workflow.

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.

Example

For 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.