@starfallprojects/n8n-nodes-powershell
v1.0.1
Published
Run PowerShell scripts within an n8n workflow.
Downloads
106
Maintainers
Readme
n8n-nodes-powershell
This is a custom node for n8n. It allows you to execute PowerShell commands within an n8n workflow.
Purpose
n8n provides an Execute Command node, which allows you to execute scripts on your system's default shell. On Windows, this is Command Prompt (cmd). There is currently no option to use PowerShell, other than changing your system's default shell. This node provides an alternative. It copies heavily from the Execute Command node (source for that node is here if you're curious just how blatantly I've copied).
Installation
- Make sure you have PowerShell installed on the same machine as n8n. The node gives you the option to use either your default PowerShell installation, or your default PowerShell Core installation. You can't choose between multiple PowerShell (or PowerShell Core) versions.
- Follow the n8n documentation to install community nodes.
Limitations
Not available on Cloud or Desktop
Like the Execute Command node, the PowerShell node won't work on n8n Cloud.
Community nodes are currently unavailable on n8n Desktop.
Requires PowerShell
You must have PowerShell installed on the same machine as n8n.
Limited PowerShell selection
You can choose either PowerShell or PowerShell Core to run your script. The node uses the default installation. This means if you have PowerShell 3.x, 4.x, and 5.x installed, it will automatically use the default. You can't use the node to select an alternative installation. This shouldn't be a problem with PowerShell, as the latest version has good backwards compatibility, but you may need to be aware of differences between the main PowerShell Core versions.
Technical background
This node uses execPromise
, an n8n function that promisifies Node.js' child_process.exec()
. Refer to the Node.js 16.x documentation for more background.
Note: because we're using
exec
rather thanspawn
, there is no option to detach the child process. This means the n8n workflow waits for the PowerShell script to complete before proceeding.
Note:
exec
is designed to handle commands with small outputs. Be cautious about using this node for memory-heavy operations.