Symptoms
Error while executing PowerShell scripts in TimeXtender Orchestrator. Error Message received:
Error: PowerShell script contains malicious content and has been blocked by antivirus software.
Cause
The antivirus software on the server running the TimeXtender environment is blocking the execution of the PowerShell script due to it being flagged as containing malicious content.
Resolution
To resolve this issue, follow these steps:
-
Understand the Execution Flow:
- PowerShell scripts are executed externally from TimeXtender Classic.
- The execution starts in the cloud and the PowerShell package is set to execute through the External Gateway.
- The External Gateway polls every 10-60 seconds and picks up the script to be executed.
- Depending on the configuration, the script is either executed on the External Gateway or queued for the Internal Gateway.
-
Configure Antivirus Software:
- Ensure that the antivirus software on the server running the TimeXtender environment is configured to allow the execution of the PowerShell scripts.
- Add exceptions for the specific scripts or the directories where the scripts are stored.
-
Verify Gateway Configuration:
- Ensure that the External Gateway and Internal Gateways are correctly configured as per the environment setup.
- The External Gateway should be running under an AD user that has access to the TimeXtender Classic Production environment.
- The Internal Gateways should be running under different AD users that have access to the respective Test and Acceptance environments.
-
Check Execution Policies:
- Verify and update the PowerShell execution policies to ensure that the user executing the script has adequate permissions.
- Use the following commands to check and set the execution policy:
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
-
Install Required Modules:
- Ensure that all required PowerShell modules are installed for the user running the script.
- For example, to install the SqlServer module, use the following command:
Install-Module SqlServer -Scope CurrentUser -AllowClobber