title: PowerShell: Restart Service By Executable Name
body: <p>all</p>
  
  <p>I implemented my first PowerShell script, that does some setup, sets registry keys and at then end needs to restart services. The problem is that I have only have name of the executable, but not service name. Restart-Service can work only with name of the service. Googling (well Binging also) around didn't give me much result.</p>
  
  <p><strong>I was wondering whether there is a way to restart service by executable name?</strong></p>
  
  <p>I know that I can get process by executable name, but just killing the process and starting it again is NOT good choice, since service Start/Stop functions are not called and it may not work properly.</p>
  
  <p>Thanks.</p>