IBM Support

How can I use runascurrentuser.exe to run commands?

Technote (troubleshooting)


Problem(Abstract)

A utility, RunAsCurrentUser, can run commands on Windows systems using the credentials and local context of the currently logged on user.

Resolving the problem

A utility, RunAsCurrentUser, can run commands on Windows systems using the credentials and local context of the currently logged on user.

RunAsCurrentUser.exe is currently available at the following location:
http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

The basic usage for the command is as follows 
RunAsCurrentUser.exe [--w] [--q] <program executable> <flags>

Waiting: RunAsCurrentUser is not a console application; to wait for it to complete before continuing with other actions you will need to use the -w flag in addition to wait or waithidden. Examples:

  1. Wait for a command to finish:
    wait RunAsCurrentUser.exe --w msiexec.exe /i MyProgram.msi /qn
  2. Wait for a command to finish and try to suppress output:
    waithidden RunAsCurrentUser.exe --w msiexec.exe /i MyProgram.msi /qn

Relevance: Any Fixlet message or action that uses "RunAsCurrentUser.exe" should have the relevance "exists current user" attached. "RunAsCurrentUser.exe" will not work unless a user is logged into the local computer. You can accomplish this by selecting the option "Run when at least one of the selected users is logged on, and only display the user interface to those users" on the Users tab in the Take Action dialog box when deploying the action.

Privileges: Note that you accept the local user privileges when you are running as the current user and if the user doesn't have access to install or run certain applications, then your Fixlet message or action will not work. Furthermore, programs that require privilege elevation on Vista, Windows 7, or Server 2008 may require special handling even if the current user has rights to run them. You can use cmd.exe to enable privilege escalation. Example:
Wait for a command to finish and try to suppress output with privilege elevation protection:
waithidden RunAsCurrentUser.exe --w cmd.exe /c msiexec.exe /i MyProgram.msi /qn

Run Quietly: While the waithidden command will cause the TEM Agent parent process to attempt to suppress output, this is not always effective. Use the --q switch to cause RunAsCurrentUser to attempt to suppress visible output as well. Example:
Wait for a command to finish and try to suppress output with privilege elevation protection:
waithidden RunAsCurrentUser.exe --w --q cmd.exe /c msiexec.exe /i MyProgram.msi /qn

Historical Number

392

Document information

More support for: IBM BigFix family

Software version: Version Independent

Operating system(s): Platform Independent

Reference #: 1506033

Modified date: 27 October 2015


Translate this page: