title: Stop a process running longer than an hour
body: <p>I posted a question a couple ago, I needed a powershell script that would start a service if it was stopped, stop the process if running longer than an hour then start it again, and if running less than an hour do nothing. I was given a great script that really helped, but I'm trying to convert it to a "process". I have the following code (below) but am getting the following error </p>
  
  <p><strong>Error</strong>
  "cmdlet Start-Process at command pipeline position 3
  Supply values for the following parameters:
  FilePath: "</p>
  
  <p><strong>Powershell</strong></p>
  
  <pre><code># for debugging
  $PSDefaultParameterValues['*Process:Verbose'] = $true
  $str = Get-Process -Name "Chrome"
  
  if ($str.Status -eq 'stopped') {
      $str | Start-Process
  } elseif ($str.StartTime -lt (Get-Date).AddHours(-1)) {
      $str | Stop-Process -PassThru | Start-Process
  } else {
      'Chrome is running and StartTime is within the past hour!'
  }
  
  # other logic goes here
  </code></pre>