How to Create a Software Delivery Package that Runs a Powershell script (.ps1).
search cancel

How to Create a Software Delivery Package that Runs a Powershell script (.ps1).

book

Article ID: 30092

calendar_today

Updated On:

Products

CA Client Automation - IT Client Manager CA Client Automation CA Client Automation - Software Delivery

Issue/Introduction

Normal .BAT files are not able to run complex script files. That is why, more and more powershell scripts are used instead. This article explains what needs to be done to accomplish this, when a powershell script needs to be run under control of the SDAgent.

Environment

CA Client Automation - All versions

Resolution

Before starting to create packages that run Powershell scripts, verify that configuration policy is set correctly: 

First, DSM > Software Delivery > Agent > File Association: Powershell Scripts interpreter needs to be set to the correct interpreter and parameter to accept the script, normally 'Powershell.exe -File'

 

Next, for 64bit Windows agents, configuration policy needs to specify if the 32bit or 64bit of the Powershell interpreter needs to be used. This is listed in DSM > Software Delivery > Agent > Fie Association: Powershell Scripts interpreter bit mode, by default set to 32bit mode.

 

 

If you made any changes different from the defaults, you need to deploy the modified configuration policy to the agents that will run the Powershell scripts.

Create a package and paste the Powershell script to the source together with any additional needed files. Then create the installation procedure and specify the PS1 file. 

 

 

It will cause the agent to run (for this example) Powershell.exe -File Power1.ps1

Additional parameters can be specified in the Parameters box as usual.