Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion Uptime change #36

Open
BourbonCrow opened this issue Dec 6, 2023 · 0 comments
Open

Suggestion Uptime change #36

BourbonCrow opened this issue Dec 6, 2023 · 0 comments

Comments

@BourbonCrow
Copy link

BourbonCrow commented Dec 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant