Function/System/Get-F2BStatus.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function Get-F2BStatus(){
    <#
    .SYNOPSIS
    Function to get the fail2ban service status
    .EXAMPLE
        C:\PS> Get-F2BStatus
    .NOTES
        Author : Thomas ILLIET
        Date : 2018-02-15
        Last Update : 2018-02-15
    #>

    
    if((Test-F2BScheduledTask -Name 'Fail2Ban-Service') -eq $true) {
        $State = (Get-ScheduledTask -TaskName 'Fail2Ban-Service').State
        write-host $State
    } else {
        Write-Error "Unable to find Scheduled Task (Fail2Ban-Service)"
    }
}