Professional Documents
Culture Documents
Short description
Long description
The Sequence script block lets you run more commands in parallel by
allowing you to run dependent commands sequentially.
Syntax
workflow <Verb-Noun>
{
Sequence
{
[<Activity>]
[<Activity>]
# ...
}
}
workflow <Verb-Noun>
{
Parallel
{
[<Activity>]
Sequence
{
[<Activity>]
[<Activity>]
# ...
}
}
}
Detailed description
The commands in a Parallel script block can run concurrently. The order in
which they run is not determined. This feature improves the performance of
a script workflow.
However, when the Sequence script block appears in a Parallel script block,
the order in which the Sequence script block runs isn't determined. It
might run before, after, or concurrent with other activities in the
Parallel script block.
For example, the following workflow includes a Parallel script block that
runs activities that get processes and services on the computer. The
Parallel script block contains a Sequence script block that gets
information from a file and uses the information as input to a script.
workflow Test-Workflow
{
Parallel
{
Get-Process
Get-Service
Sequence
{
$Hotfix = Get-Content 'D:\HotFixes\Required.txt'
Foreach ($h in $Hotfix) {'D:\Scripts\Verify-Hotfix' -Hotfix $h}
}
}
}
See also
about_ForEach
about_ForEach-Parallel
about_Language_Keywords
about_Parallel
about_Workflows