Add PowerShell Get-Uptime function
This commit is contained in:
parent
4d23b17710
commit
d087e6d040
1 changed files with 6 additions and 0 deletions
|
@ -72,6 +72,12 @@ if ($IsWindows -or ($env:OS -eq "Windows_NT")) {
|
||||||
$env:__COMPAT_LAYER = "RunAsInvoker"
|
$env:__COMPAT_LAYER = "RunAsInvoker"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(Get-Command Get-Uptime -ErrorAction SilentlyContinue)) {
|
||||||
|
function Get-Uptime {
|
||||||
|
Get-WmiObject Win32_OperatingSystem | Select-Object @{LABEL='LastBootUpTime';EXPRESSION={$_.ConvertToDateTime($_.LastBootUpTime)}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Force UTF-8 output.
|
# Force UTF-8 output.
|
||||||
$OutputEncoding = [System.Text.Encoding]::UTF8
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue