Allows the procedure to pass commands to the command interpreter on the managed machine. When this command is selected, the field Enter the command to execute in a command shell is displayed. Enter a command in the field. The command must be syntactically correct and executable with the OS version on the managed machine. Commands and parameters containing spaces should be surrounded by quotes. Since the command is executed relative to the agent directory, absolute paths should be used when entering commands.
Note: executeShellCommand() opens a command prompt window on a managed Windows machine to execute in. If you do not want a window opening on a managed Windows machine, because it might confuse users, put all the commands in a batch file. Send that file to the managed Windows machine using the writeFile() command. Then run the batch file with the executeFile() command. executeFile() does not open a window on a managed Windows machine.
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.Agent Control.Remove K Menu
executeShellCommand("rmdir "%ALLUSERSPROFILE%\Start Menu\Programs\Kaseya" /S /Q", "Execute as System", "Windows 8.1", "Halt on Fail")