$a=(Get-WmiObject -class Win32_OperatingSystem).lastbootuptime $restartTime=$a.substring(0,4)+"-"+$a.substring(4,2)+"-"+$a.substring(6,2)+" "+$a.substring(8,2)+":"+$a.substring(10,2) $restartTime