title: Stop a Windows Service that is dependant on another service via Batch File
body: <p>All,</p>
  
  <p>I'm trying to stop a Windows service that we have created that is dependant on another service.  I just want to stop both of the service using a batch file, sc command for example, where the services are running on a remote machine.</p>
  
  <p>I have tried stopping the services in the order of dependancy (least dependant first), but it does not stop the service.</p>
  
  <p>For example Service1 depends upon Service2 which is configured within the Service settings in the Services console.  I am running the script on my Windows 7 PC and the server runs Windows Server 2003.</p>
  
  <p>The following lines are in the noddy batch file I created:</p>
  
  <pre><code>sc \\SERVER stop "Service1"
  sc \\SERVER stop "Service2"
  </code></pre>
  
  <p>The output in the Command Console is:</p>
  
  <pre><code>D:\Test&gt;sc \\SERVER stop "Service2"
  [SC] ControlService FAILED 1051:
  
  A stop control has been sent to a service that other running services are dependent on.
  </code></pre>
  
  <p>The service Service2 will not stop.  Service1 stops fine.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks,</p>
  
  <p>Andez</p>