# Delete and stop the service if it already exists.
if (Get-Service timebeat -ErrorAction SilentlyContinue) {
  Stop-Service timebeat
  (Get-Service timebeat).WaitForStatus('Stopped')
  Start-Sleep -s 1
  sc.exe delete timebeat
}
