functions/Stop-PSClock.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Function Stop-PSClock {
    [cmdletbinding(SupportsShouldProcess)]
    [OutputType("none")]
    Param()

    if ($IsLinux -OR $isMacOS) {
        Write-Warning "This command requires a Windows platform"
        return
    }

    if ($PSClockSettings -And $PSClockSettings.Running) {
        if ($PSCmdlet.ShouldProcess("PSClock [runspace id $($PSClockSettings.runspace.id)]")) {
            $PSClockSettings.Running = $False
        }
    }
    else {
        Write-Warning "Can't find a running clock."
    }
}