forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSWorkflowUtility.psm1
More file actions
34 lines (33 loc) · 924 Bytes
/
Copy pathPSWorkflowUtility.psm1
File metadata and controls
34 lines (33 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
workflow Invoke-AsWorkflow
{
<#
.EXTERNALHELP Microsoft.PowerShell.Workflow.ServiceCore.dll-help.xml
#>
[System.Security.SecurityCritical()]
[CmdletBinding(DefaultParameterSetName='Command', HelpUri='http://go.microsoft.com/fwlink/?LinkId=238267')]
param(
[Parameter(Mandatory=$true,ParameterSetName="Command")]
[ValidateNotNullOrEmpty()]
[String]$CommandName,
[Parameter(ParameterSetName="Command")]
[HashTable]$Parameter,
[Parameter(Mandatory=$true,ParameterSetName="Expression")]
[String]$Expression
)
if($CommandName)
{
if($Parameter)
{
InlineScript {& $using:CommandName @using:Parameter}
}
else
{
InlineScript {& $using:CommandName}
}
}
else
{
Invoke-Expression -Command $Expression
}
}
Export-ModuleMember -Function Invoke-AsWorkflow