add pode and api scripts
This commit is contained in:
parent
30a3d7711e
commit
94bc297ea1
20 changed files with 783 additions and 3 deletions
29
Scripts/Get-Uptime.psm1
Normal file
29
Scripts/Get-Uptime.psm1
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
function Get-Uptime {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remote and local check uptime via WMI
|
||||
.DESCRIPTION
|
||||
Example:
|
||||
Get-Uptime localhost # default (or remote host)
|
||||
.LINK
|
||||
https://github.com/Lifailon
|
||||
#>
|
||||
Param (
|
||||
$srv="localhost"
|
||||
)
|
||||
if ($srv -like "localhost") {
|
||||
$boottime = Get-CimInstance Win32_OperatingSystem | select LastBootUpTime
|
||||
} else {
|
||||
$boottime = Get-CimInstance -ComputerName $srv Win32_OperatingSystem | select LastBootUpTime
|
||||
}
|
||||
$datetime = (Get-Date) - $boottime.LastBootUpTime
|
||||
$global:uptime = [string]$datetime.Days+" days "+[string]$datetime.Hours+" hours "+
|
||||
[string]$datetime.Minutes+" minutes"
|
||||
$LastTime = [string]$boottime.LastBootUpTime.DateTime
|
||||
$Collections = New-Object System.Collections.Generic.List[System.Object]
|
||||
$Collections.Add([PSCustomObject]@{
|
||||
Uptime = $uptime;
|
||||
BootTime = $LastTime
|
||||
})
|
||||
$Collections
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue