#Powershell Service Uptime

So i wanted to see how long a couple of BlackBerry servers had been up, but I wanted to know how long the services has been running.  So i knocked this up.  Its dead simple to change for other services!

$Servers = "BES01", "BES02"
$Matrix = @()
ForEach($Server in $Servers){
  Write-Host $Server -Foregroundcolor Green
  $SVC = Get-Service -ComputerName $Server | Where {$_.Name -like "Black*"}
  Foreach($item in $SVC){
    $tmpMatrix="" | Select Server, Service, State, Uptime
    Write-Host "-" $Item.Name
    $tmpMatrix.Server = $Server
    $tmpMatrix.Service = $item.Name
    $s = gwmi win32_service -ComputerName $Server -filter "name = ‘$($item.Name)’"
    $tmpMatrix.State = $s.State
    If ($s.State -eq "Running"){
      $tmpUpTime = "{0}" -f ((get-date) – ([wmi]”).ConvertToDateTime((gwmi Win32_Process  -ComputerName $Server -filter "ProcessID = ‘$($s.ProcessId)’").CreationDate))
      $tmpMatrix.Uptime = $tmpUpTime
    }
    $Matrix += $tmpMatrix
  }
}
  $Matrix