# Powershell can't see "stopping" service?

**URL:** <https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099>\
**Category:** PowerShell Help\
**Created:** [July 31, 2017, 12:44pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099 "2017-07-31T12:44:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 31, 2017, 12:44pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/1 "2017-07-31T12:44:41Z")

</div>

I see in services.msc I have a service that has a status of “Stopping” and is hung there, so my agent is effectively not working. I wish to to Kill and re-start this service and had attempted to execute

```
Get-Service | where-object { $_.status -eq “Stopping” }
```
  
…but I come up empty handed.

Any other ideas to identify this rogue service, stop it then re-start it?

thanks

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [July 31, 2017, 12:46pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/2 "2017-07-31T12:46:15Z")

</div>

Have you tried querying Win32\_Service instead? Curious if the result is different.

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 31, 2017, 1:34pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/3 "2017-07-31T13:34:23Z")

</div>

Found it.

re: STATUS

.msc displays one name (“ **Stopping** ”), Get-Service displays another (“ **StopPending** ”) and Get-WmiObject displays a third (“ **Degraded** ”)

In order to find the “Stop Pending” with Get-WmiObject, I would have had to search against _State_ (not Status)

```
Get-WmiObject Win32_service | Where-Object { $_.Name -like 'NP*' }

ExitCode : 0
Name : NPSrvHost
ProcessId : 2420
StartMode : Auto
State : Stop Pending
Status : Degraded
```

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [July 31, 2017, 2:12pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/4 "2017-07-31T14:12:40Z")

</div>

Under the hood it’s a numeric value, so different interfaces interpret it into different English strings. That’s why. And yes, WMI exposes it as State, not Status.

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [July 31, 2017, 2:16pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/5 "2017-07-31T14:16:41Z")

</div>

Don: thank you

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:38pm UTC](https://forums.powershell.org/t/powershell-cant-see-stopping-service/9099/6 "2024-05-16T20:38:23Z")

</div>


