executeShellCommandToVariable()

Executes a shell command and returns output created during and after its execution to a variable. The variable must be referred to in subsequent steps as #global:cmdresults#.

Operating systems supported: Windows, Linux, OS X.

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

useCredential("All Operating Systems", "Halt on Fail")
executeShellCommandtToVariable("dir %APPDATA%", "User", true, "All Operating Systems", "Halt on Fail")
pauseProcedure(2, "All Operating Systems", "Halt on Fail")
writeProcedureLogEntry("#global:cmdresults#", "All Operating Systems", "Halt on Fail")