powershell-profile icon indicating copy to clipboard operation
powershell-profile copied to clipboard

Suggestion Uptime change

Open BourbonCrow opened this issue 1 year ago • 0 comments

function uptime {
    $bootuptime = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
    $CurrentDate = Get-Date
    $uptime = $CurrentDate - $bootuptime
    #Windows Powershell only
        net statistics workstation | Select-String "since" | foreach-object {$_.ToString().Replace('Statistics since ', 'Last Reboot: ')}
    Write-Output "Uptime: Days: $($uptime.days), Hours: $($uptime.Hours), Minutes:$($uptime.Minutes), Seconds:$($uptime.Seconds)"
    Remove-Variable bootuptime
    Remove-Variable CurrentDate
    Remove-Variable uptime
}

image preview of how that looks in powershell, works in both 5 and 7

BourbonCrow avatar Dec 06 '23 03:12 BourbonCrow