CmdID / PowerShell / Cmdlets / Invoke
Invoke-AsWorkflow
Runs a command or expression as a Windows PowerShell Workflow. PowerShell reference
From the PowerShell reference 4 parameters
What it does
Runs a command or expression as a Windows PowerShell Workflow. The Invoke-AsWorkflow workflow runs any command or expression as an inline script in a workflow. These workflows use the standard workflow semantics, have all workflow common parameters, and have all benefits of workflows, including the ability to stop, resume, and recover. Workflows are designed for long-running commands that collect critical data, but can be used to run any command. For more information, see about_Workflows. You can also add workflow common parameters to this command. For more information about workflow common parameters, see about_WorkflowCommonParameters This workflow is introduced in Windows PowerShell 3.0.
Invoke-AsWorkflow [-CommandName <String>] [-Parameter <Hashtable>] [-InputObject <Object>] [<CommonParameters>]Invoke-AsWorkflow [-Expression <String>] [-InputObject <Object>] [<CommonParameters>]
Run a cmdlet as a workflow
Invoke-AsWorkflow -PSComputerName (Get-Content Servers.txt) -CommandName Get-ExecutionPolicyIdentifyRun a cmdlet with parameters
$s = Import-Csv .\Servers.csv -Header ServerName, ServerID
Invoke-AsWorkflow -CommandName Get-ExecutionPolicy -Parameter @{Scope="Process"} -PSComputerName {$s.ServerName} -PSConnectionRetryCount 5IdentifyRun an expression as a workflow
Invoke-AsWorkflow -Expression "ipconfig /all" -PSComputerName (Get-Content DomainControllers.txt) -AsJob -JobName IPConfigIdentifyTrips 1 Sigma rule: lowSuspicious Network Command by frack113, Christopher Peacock '@securepeacock', SCYTHE '@scythe_io'
Its page in the reference: Invoke-AsWorkflow.
Parameters
-CommandNameRuns the specified cmdlet or advanced function as a workflow. Enter the cmdlet or function name, such as Update-Help, Set-ExecutionPolicy, or Set-NetFirewallRule.-ExpressionSpecifies the expression that this cmdlet runs as a workflow. Enter the expression as a string, such as "ipconfig /all". If the expression includes spaces or special characters, enclose the expression in quotation marks.-InputObjectUsed to allows pipeline input.-ParameterSpecifies the parameters and parameter values of the command that is specified in the CommandName parameter. Enter a hash table in which each key is a parameter name and its value is the parameter value, such as @{ExecutionPolicy="AllSigned"}.
For information about hash tables, see about_Hash_Tables.