Answers: <p>The <code>-name</code> parameter of the <code>Stop-Service</code> command is an [array strings][1]. You can pass multiple services to it.</p>
  
  <pre><code>Stop-Service -name service1,service2,service3
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>[string[]]$services = @('service1', 'service2')
  Stop-Service -Name $services -NoWait
  while ((Get-Service -Name $services | Where-Object { $_.status -ne 'Stopped'}).Count -ne 0)
  {
      Start-Sleep -Seconds 5
  }
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-21T06:59:37.983Z
Answers: I have tried this command, but it's not stopping services at the same time. I am getting below output.
  
  `WARNING: Waiting for service 'MyFirstService1 (MyFirstService1)' to stop...
  WARNING: Waiting for service 'MyFirstService1 (MyFirstService1)' to stop...`
Answers: ankit thakkar
Answers: CC BY-SA 4.0
Answers: 2020-02-21T07:54:01.570Z
Answers: @ankitthakkar - I misunderstood your requirement. In that case, you can not use Stop-Service like this. You'd have to wrap each stop service in a job or async procedure but even then, you can never be sure they all stop **at the exact same time**. Each will get **a stop command** at around the same time though.
Answers: Lieven Keersmaekers
Answers: CC BY-SA 4.0
Answers: 2020-02-21T08:51:15.903Z
Answers: I am using the stop-service command to stop all the service by using -NoWait but I also want that it will not move to the next step till all services will stop.
Answers: ankit thakkar
Answers: CC BY-SA 4.0
Answers: 2020-02-21T09:34:14.323Z
Answers: In that case, you can write a loop to check if all services are stopped. I have added this to my answer
Answers: Lieven Keersmaekers
Answers: CC BY-SA 4.0
Answers: 2020-02-21T11:41:55.643Z
Answers: I have resolved this using loop and `WaitForStatus` Argument of service.
Answers: ankit thakkar
Answers: CC BY-SA 4.0
Answers: 2020-02-21T11:42:27.590Z
Answers: Thanks @Lieven for your support !!!
Answers: ankit thakkar
Answers: CC BY-SA 4.0
Answers: 2020-02-21T12:23:38.040Z
Answers: @ankitthakkar - You are welcome. I didn't know `WaitForStatus` myself.
Answers: Lieven Keersmaekers
Answers: CC BY-SA 4.0
Answers: 2020-02-21T06:47:50.130Z
Answers: 2020-02-21T09:50:10.770Z
Answers: 2020-02-21T09:50:10.770Z
Answers: Lieven Keersmaekers
Body: <p>I have multiple windows service and there are no dependencies between them. I want to stop all the windows services at the same time. I don't want to stop all the services one by one. How can I achieve this?</p>
  
Tags: <powershell>
Title: Stop Multiple Windows Service Simultaneously
UserDisplayName: ankit thakkar
ThreadText: # Stop Multiple Windows Service Simultaneously
  
  (Asked by: username_0 on 2020-02-21)
  
  I have multiple windows service and there are no dependencies between them. I want to stop all the windows services at the same time. I don't want to stop all the services one by one. How can I achieve this?
  
  **Tags:** powershell
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-21. Score: 1
  
  The `-name` parameter of the `Stop-Service` command is an [array strings][1]. You can pass multiple services to it.
  
  ```
  Stop-Service -name service1,service2,service3
  
  ```
  
  **Edit**
  
  ```
  [string[]]$services = @('service1', 'service2')
  Stop-Service -Name $services -NoWait
  while ((Get-Service -Name $services | Where-Object { $_.status -ne 'Stopped'}).Count -ne 0)
  {
      Start-Sleep -Seconds 5
  }
  
  ```
  
  > **Comments:**
  > **username_0**: I have tried this command, but it's not stopping services at the same time. I am getting below output.  `WARNING: Waiting for service 'MyFirstService1 (MyFirstService1)' to stop... WARNING: Waiting for service 'MyFirstService1 (MyFirstService1)' to stop...`  
  > **username_1**: @username_0 - I misunderstood your requirement. In that case, you can not use Stop-Service like this. You'd have to wrap each stop service in a job or async procedure but even then, you can never be sure they all stop **at the exact same time**. Each will get **a stop command** at around the same time though.  
  > **username_0**: I am using the stop-service command to stop all the service by using -NoWait but I also want that it will not move to the next step till all services will stop.  
  > **username_1**: In that case, you can write a loop to check if all services are stopped. I have added this to my answer  
  > **username_0**: I have resolved this using loop and `WaitForStatus` Argument of service.  
  > **username_0**: Thanks @username_1 for your support !!!  
  > **username_1**: @username_0 - You are welcome. I didn't know `WaitForStatus` myself.  
  
  ---
  
  