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

Script to get number of days machine is online #103

Open
Ebag333 opened this issue Oct 9, 2019 · 0 comments
Open

Script to get number of days machine is online #103

Ebag333 opened this issue Oct 9, 2019 · 0 comments

Comments

@Ebag333
Copy link
Member

Ebag333 commented Oct 9, 2019

$OBJ_OperatingSystem = Get-WmiObject -Class Win32_OperatingSystem
$BootTime = [System.Management.ManagementDateTimeConverter]::ToDateTime($OBJ_OperatingSystem.LastBootUpTime)
$LocalTime = [System.Management.ManagementDateTimeConverter]::ToDateTime($OBJ_OperatingSystem.LocalDateTime)
$TimeSpan = New-TimeSpan -Start $Boot -End $Local
Write-Output $TimeSpan.Days

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