I'm trying to put together a very simple code that outputs the server name, the last reboot date, and then the difference in hours and days.  I've tried several iterations of Write-Host, but I can't seem to get the output I expect.  The output should be something like this:
ServerName | Reboot Date | Time Running (Day, Hours)
Here is the code:
begin {}
process {
  foreach($server in (gc d:\win_IP.txt)){
    if(Test-Connection -ComputerName $server -Count 1 -ea 0) {
      $strFQDN = [System.Net.Dns]::GetHostbyAddress($server) | Select-Object HostName -ErrorAction "SilentlyContinue"
      $wmi = Get-WmiObject -Class Win32_OperatingSystem -Computer $server 
      $strDate = $wmi.ConvertToDateTime($wmi.LastBootUpTime)
      $strDiff = [DateTime]::Now - $wmi.ConvertToDateTime($wmi.LastBootUpTime) | Format-Table Days, Hours
    } else {
      Write-Verbose "$server is offline"
    }            
  }
}            
end {}
If someone could explain just how combining variables works, as well as how to format the output, I'd really appreciate it.
Thanks in advance.


-Quietparameter if you are usingTest-Connectionin anifstatement.