functions/taskengine/Get-PSFTaskEngineTask.ps1

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
function Get-PSFTaskEngineTask
{
    <#
  .SYNOPSIS
   Returns tasks registered for the task engine
   
  .DESCRIPTION
   Returns tasks registered for the task engine
   
  .PARAMETER Name
   Default: "*"
   Only tasks with similar names are returned.
   
  .EXAMPLE
   PS C:\> Get-PSFTaskEngineTask
  
   Returns all tasks registered to the task engine
  
  .EXAMPLE
   PS C:\> Get-PSFTaskEngineTask -Name 'mymodule.*'
  
   Returns all tasks registered to the task engine whose name starts with 'mymodule.'
   (It stands to reason that only tasks belonging to the module 'mymodule' would be returned that way)
 #>

    [CmdletBinding()]
    Param (
        [string]
        $Name = "*"
    )
    
    [PSFramework.TaskEngine.TaskHost]::Tasks.Values | Where-Object Name -Like $Name
}