[sourcecode language=”powershell” wraplines=”false”]
#Return the last reboot time of a computer
#Usage: Get-LastBootUpTime [ServerName]
Function Get-LastBootUpTime
{
param ([string]$computername=$env:computername)
$computername = $computername.toupper()
Get-WmiObject -ComputerName $computername win32_operatingsystem| select csname, @{LABEL=’LastBootUpTime’;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
}
[/sourcecode]
Powershell Function to Get the Last Boot Up Time of a Computer
by
Tags:
Leave a Reply