Hiya,
I like to use Write-Progress in modules/scripts alot to show the progress in dashboards.
Currently, the progress message displays in the bottom left of the dashboard.
I’d like it to show in a UD Modal or in the middle of the dashboard.
TLDR: How would I change the styling of Write-Progress message globally?
I made a custom function to achieve something like you describe.
function Show-JobProgress {
New-UDDynamic -Id 'dynamic_jobProgress' -AutoRefresh -AutoRefreshInterval 5 -Content {
[cmdletbinding()]
param (
[Parameter(Mandatory = $true)][string]$jobName
)
$job = Get-PSUJob -Script (Get-PSUScript -Name $jobName) -First 1
if ($job.status -eq 'Running') {
New-UDAlert -Id 'alert_jobProgress' -Severity info -Title "Job is currently running! ($($job.PercentComplete)%)" -Content {
New-UDIcon -Icon 'Spinner' -Spin
" $($job.CurrentOperation)"
}
}
}
}
Which I would then use within my dashboard/app wherever I seem fit.