Client Automation - How to create an Asset Job which executes a powershell script ?
search cancel

Client Automation - How to create an Asset Job which executes a powershell script ?

book

Article ID: 139629

calendar_today

Updated On:

Products

CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation

Issue/Introduction

AM Asset Job could be of type :

Command : DOS/Windows command (.bat, .cmd)

Script : DMS script

 

But how to execute a .ps1 script (powershell) ?

 

Environment

Release : All

Component : Client Automation

Resolution

1- Create a new AM Asset Job and select "External Utility" as Job Type :



2- Click NEXT and give a name. Click NEXT



3- Enter following values :

Executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Working dir: C:\Windows\TEMP

Parameters: -ExecutionPolicy ByPass -File C:\Windows\TEMP\test.ps1


Create text file: C:\Windows\TEMP\test.ps1





4- Click NEXT and enter the script text

Example :

[string]$LogFile = "C:\Windows\temp\file.log"

Add-Content -Path $Logfile -Value "Hello World."



5- Click NEXT. Click on Set Scheduling button and select tab "Miscellaneous'.

Check the box "This job is allowed to run unattended"