Running PowerShell Scripts
This action aims to run the PowerShell scripts in the specified path on the Windows host.
Configuring Deployment Actions
- Create an application by referring to Creating an Application.
- On the Deployment Actions page, add this deployment action based on the service scenario.
- Configure the action using the parameters described in the table below.
Table 1 Parameters Parameter
Description
Action Name
Custom action name. Enter 1 to 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./()
Environment
Deployment object. Select an environment whose resource type is host cluster.
Running Mode
Default and Background are available.
NOTE:- Default: The result is printed, but the related service or process cannot be started.
- Background: The service or process can be started, but the result will not be printed.
Script Path
Path of the script on the target host.
Running Parameters
Before executing the script, set parameters. During script execution, the entered parameter values are loaded and used.
Action Control
Whether to enable the settings.
- Keep running on failure: Continue the task even if this action fails.
How Do I Use PowerShell Script Execution Parameters?
- Use param($a,$b) at the beginning of the script to declare variables a and b.
- Use variables $a and $b in the script.
- When running the script, enter the values of variables a and b in the script running parameters and separate them with spaces.
Example:
The following figure shows the content of the hello.ps1 script. Set an environment variable to import a temporary value.
Figure 1 Script content
Configure parameters.
Figure 2 Settings
- Check the result. Figure 3 Result
Helpful Links
If you encounter any problem during deployment, see Running PowerShell Scripts.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot