Executes the specified file on the managed machine. This function replicates launching an application using the Run… command located in the Microsoft Windows Start menu. This function takes three parameters:
.exe
file..exe
file.exe
completes or not. Note: Environment variables are acceptable, if they are set on a user's machine. For example, using a path %windir%\notepad.exe
, would be similar to C:\windows\notepad.exe
.
If Execute as the logged on user is selected, then a credential must be specified by running either the impersonateUser() or useCredential() command before this command. If run Execute as the system account is selected, execution is restricted to the agent's system level access.
Note: To avoid risk of privilege escalation attacks, scripts and files which run under System context, or as an Administrator level user, should be executed from a folder with locked down ACL permissions. The VSA agent provides a default folder called "System", under the Agent Working Directory, which is intended for this use. It can be stored as a variable by selecting "Secure Agent Working Directory Path" from the getVariable() command.
Example - Sample Procedures.Managed Services.System Mgmt.Shutdown
executeFile("%windir%\system32\shutdown.exe", "-s -f", "Execute as System and Continue", "Windows 8.1", "Halt on Fail")