Note: When running Powershell commands from agent procedures as System, the Execution Policy for LocalMachine context is automatically set to "Unrestricted". If you do not wish to leave this setting in place, add a statement at the end of the procedure to set it back to the desired value using Set-ExecutionPolicy command.
Executes a powershell script, including:
.PS1
fileOperating systems supported: Windows XP SP3+/Server 2008 with Powershell add-on, Windows 7, Windows Server 2008 or later
There are five variants of this command available.
System and user commands:
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
executePowershellCommand64BitSystem("#ps_service_script#, "#servicename#", false, "All Operating Systems", "All Windows Operating Systems, "Halt on Fail")