Use PowerShell scripts in Rewst
Last updated
Was this helpful?
Last updated
Was this helpful?
Rewst gives you two ways to work with PowerShell:
– Write and run PowerShell inline in workflows using the #ps
block, powered by secure Azure-hosted Function Apps.
Stored PowerShell scripts – Run traditional PowerShell scripts on external endpoints via RMMs, typically using prebuilt automations or webhooks.
This document describes the second method — using stored PowerShell scripts to execute on endpoints via Rewst automations.
Rewst supports running PowerShell on devices, typically through your RMM, by storing and executing scripts via webhooks. This is useful for direct device interaction such as installing software or gathering logs.
Store a PowerShell script in Automations > Scripts.
The script is assigned a unique URL ending in a GUID.
Call this script from a workflow or prebuilt automation, like Run PowerShell Script on Selected Devices.
Include a block in the script to send results back to Rewst.
Use ConvertTo-Json
and Invoke-WebRequest
to send structured data back to Rewst:
The data returned won’t affect execution, but it enables further automation based on the results.
Whether you're using the interpreter or calling a stored script, you can pass variables using Jinja.
This allows workflows to dynamically pass values into your scripts without hardcoding. Note that this example will only function correctly when the script is saved as a template.
For endpoint scripts, Rewst provides prebuilt automations such as the Run PowerShell Script on Selected Devices Crate.
These use subworkflows to loop through device lists and run your stored script against each one.