@echo off
echo Attempting to Start Clarity Active Directory Synch
for /F "tokens=3 delims=: " %%H in ('sc query "Clarity Active Directory Synch" ^| findstr "        STATE"') do (
  if /I "%%H" NEQ "RUNNING" (
   net start "Clarity Active Directory Synch"
  )
)