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