Run a PowerShell Command
To run a PowerShell command from a process, do the procedure in this topic.
Prerequisites
Good to Know
- In most text fields, you can use process data variables as an alternative to literal data values.
- To enter the command from a file on the server, the file must have a .bat or .txt file extension.
- To run a PowerShell command on SharePoint, use the SharePoint PowerShell Command activity.
- You can configure whether this activity waits for other activities before it runs.
For more information, refer to How Do I Configure an Activity to Wait for Other Incoming Activities?
How to Start
- On the Application Explorer screen, do one of these:
- Do one of these:
- Add an activity:
- In the Process Builder, in the Activity Library, open the Utilities tab.
- Utilities , drag the PowerShell Command activity onto your process.
- Change an activity:
- In your process, double-click your activity.
- Add an activity:
- Click PowerShell Command .
Procedure
- To run a PowerShell command, on the Configuration for calling PowerShell Command screen,do one of these.
- To enter the command manually, do this procedure.
- Select Input Text.
- In the Command field, enter your PowerShell command code.
- To enter the command from a file on the server, do this procedure.
- Select Read From File.
- Complete these fields
as necessary
Field Name Value File Path (AgilePoint Server File Path)
- Function:
- Specifies the location of the file that contains the PowerShell command.
- To Open this Field:
- Select Read From File.
- Accepted Values:
- An absolute path and file name
on the AgilePoint Server or SharePoint Server.
The file name must have the extension .bat or .txt.
- Default Value:
- None
- Accepts Process Data Variables:
- Yes
- Example:
-
- c:\My Documents\sample1.doc
- ${HomeDirectory}\sample2.doc
- http://demo3:8000/DocumentLib1/sample3.doc
- To enter the command manually, do this procedure.
- In the Return Value field, enter the process data variable where you want to store the return value returned from your PowerShell command.