User Tools

Site Tools


transformations:powershell

POWERSHELL

Category: Workflow / External


Description

This action allows executing PowerShell commands and scripts from within EasyMorph. PowerShell 3.0 or above is required.


Use cases

PowerShell is a very versatile scripting language supported by the vast ecosystem of the .NET framework. Having EasyMorph integrated with Powershell opens access to a large number of PowerShell cmdlets which help automate various tasks (e.g. advanced file operations, sending emails, computer management, and administration).

EasyMorph actions can effectively be inserted into PowerShell command pipelines (e.g. generate a list of files in EasyMorph, filter it using EasyMorph expressions, and then send the resulting list into PowerShell).

Finally, it becomes possible to write custom cmdlets (e.g. in C#) and run them from EasyMorph using EasyMorph parameters or column data.


Action settings

Setting Description
Input pipeline
(accessible via $input)
Select the input pipeline, if any. Options: None, Column, or Table.
Commands*Enter one more PowerShell commands.
Output and errorsSelect whether output and errors will be captured by EasyMorph. Options: Do not capture output. Fail on errors.
or Capture output and error collections.

* Setting can be specified using a parameter.


Remarks

It is possible to send values of a column to the executed PowerShell commands through the built-in $input variable in PowerShell, for instance:

$input | Sort-Object

Note that $input is an enumerator for the sequence, not the sequence itself.


It is possible to insert EasyMorph parameters right into the script text. Just insert parameter names in curly braces. For instance:

Copy-Item "{Source file}" c:\test


It is also possible to capture the output sequence from the PowerShell script back to EasyMorph. Note that the output sequence should be explicitly converted in the PowerShell script into a sequence of basic types such as string, integer, float, DateTime or bool. Formatted output of the standard PowerShell console is not captured.


Community examples


See also

transformations/powershell.txt · Last modified: 2021/07/17 16:26 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki