< Summary - Kestrun — Combined Coverage

Information
Class: Public.Scheduling.Get-KrScheduleReport
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Scheduling/Get-KrScheduleReport.ps1
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 65
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Scheduling/Get-KrScheduleReport.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Returns the full schedule report.
 4    .DESCRIPTION
 5        This function retrieves the current schedule report, including all scheduled jobs and their next run times.
 6    .PARAMETER Server
 7        The Kestrun host object containing the scheduler.
 8    .PARAMETER TimeZoneId
 9        Optional Windows / IANA time-zone id to convert timestamps.
 10        Example: "Pacific Standard Time"  or  "Europe/Berlin"
 11    .PARAMETER AsHashtable
 12        If set, returns a hashtable instead of a ScheduleReport object.
 13    .EXAMPLE
 14        Get-KrScheduleReport -Server $myServer
 15        Retrieves the schedule report from the specified Kestrun server.
 16    .EXAMPLE
 17        Get-KrScheduleReport -Server $myServer -TimeZoneId "Europe/Berlin"
 18        Retrieves the schedule report with timestamps converted to the specified time zone.
 19    .OUTPUTS
 20        Returns a ScheduleReport object or a hashtable if AsHashtable is set.
 21#>
 22function Get-KrScheduleReport {
 23    [KestrunRuntimeApi('Everywhere')]
 24    [CmdletBinding()]
 25    [OutputType([Kestrun.Scheduling.ScheduleReport])]
 26    [OutputType([Hashtable])]
 27    param(
 28        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 29        [Kestrun.Hosting.KestrunHost]$Server,
 30        [string]$TimeZoneId,
 31        [switch]$AsHashtable
 32    )
 33    begin {
 034        if (-not $Server) {
 035            if ($KestrunHost) {
 036                Write-KrInfoLog "No server specified, using global KestrunHost variable.($KestrunHost)"
 37                # If no server is specified, use the global $KestrunHost variable
 38                # This is useful for scripts that run in the context of a Kestrun server
 039                $Server = $KestrunHost
 40            } else {
 41                # Ensure the server instance is resolved
 042                $Server = Resolve-KestrunServer -Server $Server
 43            }
 44        }
 045        if ($null -eq $Server) {
 046            throw 'Server is not initialized. Please ensure the server is configured before setting options.'
 47        }
 48    }
 49    process {
 050        if (-not $Server.Scheduler) {
 051            throw 'SchedulerService is not enabled.'
 52        }
 53
 054        $tz = if ($TimeZoneId) {
 055            [TimeZoneInfo]::FindSystemTimeZoneById($TimeZoneId)
 056        } else { [TimeZoneInfo]::Utc }
 57
 058        if ($AsHashtable) {
 059            return $Server.Scheduler.GetReportHashtable($tz)
 60        } else {
 061            return $Server.Scheduler.GetReport($tz)
 62        }
 63    }
 64}
 65

Methods/Properties

Get-KrScheduleReport()