From 96a7af726b9e5d26832c3dcdf99af2cd6b79ae21 Mon Sep 17 00:00:00 2001 From: Kmemberg <46707278+Kmemberg@users.noreply.github.com> Date: Fri, 27 Dec 2024 10:05:27 +0100 Subject: [PATCH] Update Get-Uptime.ps1 Change some variables in output's properties and add [Ordered] to keep the order of the table. --- TOOL-Get-Uptime/Get-Uptime.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TOOL-Get-Uptime/Get-Uptime.ps1 b/TOOL-Get-Uptime/Get-Uptime.ps1 index 10d23864..bdd91a9b 100644 --- a/TOOL-Get-Uptime/Get-Uptime.ps1 +++ b/TOOL-Get-Uptime/Get-Uptime.ps1 @@ -98,7 +98,7 @@ function Get-Uptime { # Prepare output $Uptime = New-TimeSpan -Start $($CimResult.lastbootuptime) -End (Get-Date) - $Properties = @{ + $Properties = [Ordered]@{ ComputerName = $CIMComputer Days = $Uptime.days Hours = $Uptime.hours @@ -147,13 +147,13 @@ function Get-Uptime { $HumanTimeFormat = $Result.ConvertToDateTime($Result.Lastbootuptime) $Uptime = New-TimeSpan -Start $HumanTimeFormat -End $(Get-Date) - $Properties = @{ + $Properties = [Ordered]@{ ComputerName = $Computer Days = $Uptime.days Hours = $Uptime.hours Minutes = $Uptime.minutes Seconds = $Uptime.seconds - LastBootUpTime = $CimResult.lastbootuptime + LastBootUpTime = $HumanTimeFormat } # Output the information New-Object -TypeName PSObject -Property $Properties @@ -170,4 +170,4 @@ function Get-Uptime { }#FOREACH } #ELSE (Not CIM) }#PROCESS -}#Function \ No newline at end of file +}#Function