Instead of Get-WmiObject, which is deprecated, use this:
$lastBoot = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime