Powershell - Get system uptime

$Computer = Read-Host   "Input Computer Name "
$LastBoot = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer ).LastBootUpTime
$uptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($LastBoot)
Write-Host  "$Computer uptime is:"     [$uptime]   [dd:hh:mm:ss.ms]

Comments

Popular posts from this blog

SCCM Software Distribution Troubleshooting

Powershell - List AD Organizational Unit and GPOs linked to them

Troubleshooting System Center Endpoint Protection (SCEP) Client