Function Name: Get-Uptime
# ——————————————-
# Function Name: Get-Uptime
# Calculate and display system uptime on a local machine or remote machine.
# ——————————————-
function Get-Uptime {
[CmdletBinding()]
param (
[string]$ComputerName = ‘localhost’
)
foreach ($Computer in $ComputerName){
$pc = $computername
$os = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $computername
$diff = $os.ConvertToDateTime($os.LocalDateTime) – $os.ConvertToDateTime($os.LastBootUpTime)
$properties=@{
‘ComputerName’=$pc;
‘UptimeDays’=$diff.Days;
‘UptimeHours’=$diff.Hours;
‘UptimeMinutes’=$diff.Minutes
‘UptimeSeconds’=$diff.Seconds
}
$obj = New-Object -TypeName PSObject -Property $properties
Write-Output $obj
}
}
uwm2cm
naturally like your website however you have to check the spelling on quite a few of your posts. Several of them are rife with spelling issues and I find it very troublesome to inform the reality on the other hand I¦ll certainly come again again.
very good publish, i definitely love this web site, keep on it
It’s hard to find knowledgeable people on this topic, but you sound like you know what you’re talking about! Thanks
me encantei com este site. Pra saber mais detalhes acesse o site e descubra mais. Todas as informações contidas são informações relevantes e exclusivas. Tudo que você precisa saber está ta lá.
Este site é realmente demais. Sempre que acesso eu encontro coisas incríveis Você também vai querer acessar o nosso site e descobrir detalhes! conteúdo único. Venha saber mais agora! 🙂