From 2eb776610ada1accaab73afe9b85d1fc61cbfa7e Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 9 May 2022 08:33:53 +0200 Subject: [PATCH] Update write-motd.ps1 --- Scripts/write-motd.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/write-motd.ps1 b/Scripts/write-motd.ps1 index 249c8423..6faaaa0d 100755 --- a/Scripts/write-motd.ps1 +++ b/Scripts/write-motd.ps1 @@ -27,7 +27,9 @@ $OSName = "$((Get-WmiObject win32_operatingsystem).caption) Build: $([System.Env $Kernel = "NT" # todo $Kernel_Info = "" # todo -$Uptime = 'S' + $(net statistics workstation | find "Statistics since").Substring(12).Trim(); +$BootTime = Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005} | Select-Object TimeCreated -First 1 +$TimeSpan = (Get-Date) - $BootTime +$Uptime = $TimeSpan.Days + " days " + $TimeSpan.Hours + " hours " + $TimeSpan.Minutes + " minutes" $PowerShellVersion = $PSVersionTable.PSVersion $PowerShellEdition = $PSVersionTable.PSEdition