Function/Tool/Test-F2BScheduledTask.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
function Test-F2BScheduledTask(){
    <#
    .SYNOPSIS
        Function to check that the scheduled task exists
    .PARAMETER Name
        Specifies names of a scheduled task.
    .EXAMPLE
        C:\PS> Test-F2BScheduledTask -Name "MyScheduledTask"
    .NOTES
        Author : Thomas ILLIET
        Date : 2018-02-15
        Last Update : 2018-02-15
    #>

    Param(
        [Parameter(Mandatory=$true)]
        [String]$Name
    )

    $ScheduledTask = Get-ScheduledTask -TaskName $Name -ErrorAction SilentlyContinue
    if($ScheduledTask -ne $null) {
        return $true
    } else {
        return $false
    }
}