- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to stop service with their dependent services in PowerShell?
To stop the service which has dependent service in PowerShell -Force parameter is used. First, we will check what are the dependent services for specific service, to get them -DependentService parameter is used.
Example
For example, WMI service (Name: Winmgmt) has multiple dependent services.
Get-Service -Name Winmgmt -DependentServices
Output
tatus Name DisplayName ------ ---- ----------- Running UALSVC User Access Logging Service Stopped smstsmgr ConfigMgr Task Sequence Agent Stopped SepLpsService Symantec Endpoint Protection Local ... Stopped NcaSvc Network Connectivity Assistant Running iphlpsvc IP Helper Running CcmExec SMS Agent Host
Now, we will stop Winmgmt Service along with their dependent services with -Force parameter. To check the command process -verbose parameter is added.
Stop-Service -Name Winmgmt -Force -Verbose
With Displayname,
Stop-Service -DisplayName "Windows Management Instrument" -Force -Verbose
Another way to stop the dependent service is to get the dependent services first and then pipeline Stop-Service parameter and you don’t need to use -Force parameter this time, but this will only stop the dependent services, not the service which is specified.
Get-Service Winmgmt -DependentServices | Stop-Service -Verbose
The above command will stop the dependent services of Winmgmt but not itself.
- Related Articles
- How to stop service with their dependent services using PowerShell?
- How to start dependent services in PowerShell?
- How to stop multiple services using PowerShell?
- How to stop the service with the display name in PowerShell?\n
- How to stop a windows service using PowerShell?
- How to remove Windows service with PowerShell?
- How to get all the services based on their status in PowerShell?
- How to get services on remote computers with PowerShell?
- How to start windows service with display name in PowerShell?
- How to get the services on a local computer with PowerShell?
- How to group processes with their name in PowerShell?
- How to get service information with the WMI method using PowerShell?
- How to start multiple windows services using PowerShell?
- How to search for the specific service in PowerShell?
- How to get services based on start-type in PowerShell?
