What is the PowerShell Workflow?

PowerShell workflow is built on the .Net based Windows Workflow Foundation (WWF) and it has a separate Workflow engine to execute the code because it translates code into XAML for the WWF framework.

PowerShell workflow is series of steps that is mainly used for

  • Running activities parallelly on more than one machine.

  • Long-running scripts.

  • Structuring steps (Which steps will execute parallel and which in sequence)

  • Frequently used tasks.

  • Resuming the script from where it was terminated due to system failure or any other interruption by defining checkpoints.

The PowerShell workflow was introduced in PowerShell 3.0 and discontinued for windows in the Core version (6.0 onwards) and only supported in the PowerShell framework version. PowerShell workflow is considered the backbone for the Microsoft Azure Runbooks and essentials for designing runbook steps.

The disadvantage with this method is, not all the cmdlets are supported in Workflow and you can check the MS link to find the difference between the PowerShell workflow and scripts.


PowerShell workflow is defined the same as the PowerShell function but using the “Workflow” keyword and can be called by using its name only like PowerShell function.

Workflow TestWF{
   Write-Output "First PS Workflow"

Output −

PS C:\WINDOWS\system32> TestWF
First PS Workflow

Once the TestWF workflow is executed it creates a XAML code for it and you can check it using the below command.

Get-Command TestWF | fl *