Product: PowerShell Universal
Version: 5.2.2
Hi, I’d like to address two problems which I have.
May my code is wrong or this is something else but Get-PSUSchedule does not populate the latest information like next execution time, last run time and so on which maybe refers to Get-PSUSchedule does not populate next execution #4168
Also the cmdlet Get-PSUJobOutput which looks like is limited to 1000 lines.
Does anyone know if there is a workaround to get the full output of a executed script?
My code look like this:
New-UDGrid -Container -Content {
New-UDGrid -Item -ExtraSmallSize 12 -Content {
New-UDHeading -Size 2 -Text "Scheduler Jobs" -Color "White"
}
New-UDDynamic -Id "dynamic_scheduler_report_content" -Content {
$Schedules = Get-PSUSchedule -TrustCertificate | Sort-Object -Property Name
$Page:JobOutput = @{}
foreach($Schedule in $Schedules) {
New-UDGrid -Item -ExtraSmallSize 3 -Content {
$Job = Get-PSUScript -Name "$($Schedule.Script)" -TrustCertificate | Get-PSUJob -OrderDirection Descending -First 1 -TrustCertificate
$JobOutput = Get-PSUJobOutput -Job $Job -TrustCertificate
$ScheduleCardHeader = New-UDCardHeader -Title "$($Schedule.Name)" -Subheader "Next execution: $($Schedule.NextExecution.ToString("HH:mm:ss dd.MM.yyyy"))"
$ScheduleCardBody = New-UDCardBody -Content {
New-UDTypography -Text "Start time: $($Job.StartTime.ToString("HH:mm:ss dd.MM.yyyy"))"
New-UDElement -Tag "p" -Content {}
New-UDTypography -Text "Finish time: $($Job.EndTime.ToString("HH:mm:ss dd.MM.yyyy"))"
New-UDElement -Tag "p" -Content {}
New-UDTypography -Text "Last execution status:"
New-UDElement -Tag "p" -Content {}
$Style = switch($Job.Status) {
"Completed" {
"green"
}
"Warning" {
"yellow"
}
"Error" {
"red"
}
Default {
"white"
}
}
New-UDTypography -Text "$($Job.Status)" -Style @{ color = $Style } -Variant h5
} -Style @{ "min-height" = "100px" }
$ScheduleCardFooter = New-UDCardFooter -Content {
New-UDButton -Text "Details" -OnClick {
Show-UDModal -Header {
New-UDHeading -Size 2 -Text "Job output" -Color "White"
} -Content {
New-UDCodeEditor -Language 'powershell' -Code ($JobOutput -join "`r") -ReadOnly -Height "100%"
} -Footer {
New-UDButton -Text "Close" -OnClick { Hide-UDModal } -Style @{ "background-color" = "#F39200"; color = "White" }
} -FullScreen
} -Style @{ "background-color" = "#F39200"; color = "White" }
}
New-UDCard -Header $ScheduleCardHeader -Body $ScheduleCardBody -Footer $ScheduleCardFooter -Sx @{ border = "1px solid white" }
}
}
} -LoadingComponent {
New-UDProgress -Circular
} -Autorefresh -AutorefreshInterval 300
}
The result looks like this:
and every job result which has more than 1000 lines stops like this: