Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save TheRealNoob/2a3f8d1ca0d8992995c8673ce4ecdf2b to your computer and use it in GitHub Desktop.

Select an option

Save TheRealNoob/2a3f8d1ca0d8992995c8673ce4ecdf2b to your computer and use it in GitHub Desktop.
$array = @()
## Powershell Version: x.x
$array += @("PowerShell Version",(Get-Host | Select-Object -ExpandProperty Version).tostring())
## System Uptime: xx:xx:xX
$UpTime = [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime)
$UpTime = (Get-Date) - $Uptime
$UpTime = "{0:D2}" -f [int]$UpTime.Days + ':' + "{0:D2}" -f [int]$UpTime.Hours + ':' + "{0:D2}" -f [int]$UpTime.Minutes + ':' + "{0:D2}" -f [int]$UpTime.Seconds
$array += @("System Uptime",$UpTime)
$array | Format-List
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment