Skip to content

Set-Service -Status Stopped should not prevent stopping of services without dependents only because they depend on others #5517

@mklement0

Description

@mklement0

Set-Service -Status Stopped not only prevents stopping services that other services depend on (.DependentServices), but, curiously, also services that themselves depend on others (.ServicesDependedOn.

For instance, the wuauserv service has no dependents, but itself depends on the rpcss service.

As an aside: Set-Service -Status Stopped lacks a -Force switch that would allow it to stop dependent services too, the way Stop-Service offers.

Steps to reproduce

Set-Service -Status Stopped wuauserv

Expected behavior

Given that the service has no dependents, it should be stopped.

Actual behavior

The following error occurs:

Set-Service : Cannot stop service 'Windows Update (wuauserv)' because it is dependent on other services.
...

That the service depends on other services shouldn't prevent its stopping.

Environment data

PowerShell Core 6.0.0-rc on on Microsoft Windows 7 Enterprise  (64-bit; v6.1.7601)
Windows PowerShell v5.1.14409.1012 on Microsoft Windows 7 Enterprise  (64-bit; v6.1.7601)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions