CmdID

CmdID / PowerShell / Cmdlets / Invoke

Invoke-AsWorkflow

Runs a command or expression as a Windows PowerShell Workflow. PowerShell reference

From the PowerShell reference 4 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

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-ExecutionPolicyIdentify

Run a cmdlet with parameters

$s = Import-Csv .\Servers.csv -Header ServerName, ServerID Invoke-AsWorkflow -CommandName Get-ExecutionPolicy -Parameter @{Scope="Process"} -PSComputerName {$s.ServerName} -PSConnectionRetryCount 5Identify

Run an expression as a workflow

Invoke-AsWorkflow -Expression "ipconfig /all" -PSComputerName (Get-Content DomainControllers.txt) -AsJob -JobName IPConfigIdentify

Trips 1 Sigma rule: lowSuspicious Network Command by frack113, Christopher Peacock '@securepeacock', SCYTHE '@scythe_io'

Its page in the reference: Invoke-AsWorkflow.

Parameters

4 in the PowerShell reference
-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.