Skip to content

Commit 78db7be

Browse files
committed
Latest Run as Info
1 parent 4d6506c commit 78db7be

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Sources/Winget-AutoUpdate/WAU-Settings-GUI.ps1

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,18 @@ function Update-WAUGUIFromConfig {
535535

536536
# Update information section
537537
$Controls.VersionText.Text = "Version: $($updatedConfig.ProductVersion)"
538+
# Get last run time for the scheduled task 'Winget-AutoUpdate'
539+
try {
540+
$task = Get-ScheduledTask -TaskName 'Winget-AutoUpdate' -ErrorAction Stop
541+
$lastRunTime = $task | Get-ScheduledTaskInfo | Select-Object -ExpandProperty LastRunTime
542+
if ($lastRunTime -and $lastRunTime -ne [datetime]::MinValue) {
543+
$Controls.RunDate.Text = "Latest Run: $($lastRunTime.ToString('yyyy-MM-dd HH:mm'))"
544+
} else {
545+
$Controls.RunDate.Text = "Latest Run: Never"
546+
}
547+
} catch {
548+
$Controls.RunDate.Text = "Latest Run: Unknown"
549+
}
538550
$Controls.InstallLocationText.Text = "Install Location: $($updatedConfig.InstallLocation)"
539551

540552
# Update WAU AutoUpdate status
@@ -829,7 +841,11 @@ function Show-WAUSettingsGUI {
829841
<!-- Information -->
830842
<GroupBox Grid.Row="7" Header="Information" Margin="0,0,0,10">
831843
<StackPanel Margin="10">
832-
<TextBlock x:Name="VersionText" Text="Version: " FontSize="9"/>
844+
<StackPanel Orientation="Horizontal">
845+
<TextBlock x:Name="VersionText" Text="Version: " FontSize="9"/>
846+
<TextBlock Width="20"/>
847+
<TextBlock x:Name="RunDate" Text="Latest Run: " FontSize="9"/>
848+
</StackPanel>
833849
<TextBlock x:Name="InstallLocationText" Text="Install Location: " FontSize="9"/>
834850
<TextBlock x:Name="WAUAutoUpdateText" Text="WAU AutoUpdate: " FontSize="9"/>
835851
</StackPanel>

0 commit comments

Comments
 (0)