- 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 search for the specific service in PowerShell?
You can get the specific service-related information using –name parameter and you just need to provide the service name.
Command
Get-Service –Name "Spooler"
Output
Status Name DisplayName ------ ---- ----------- Running Spooler Print Spooler
Command
Similarly, you can search for more than one service with the –name parameter.
Get-Service –Name "Spooler","RemoteAccess"
Output
Status Name DisplayName ------ ---- ----------- Stopped remoteaccess Routing and Remote Access Running Spooler Print Spooler
You can also use the wildcard character (*) in service name so the console can fetch the entire name.
When wildcard character (*) is used at the end of the name then debug console will check the starting string of the name and fetch all the services which start with that particular string.
Get-Service –Name "Spoo*","RemoteAccess"
Command
When wildcard character (*) is used at both the ends then the debug console will check if the part of that string contains in the service name then it will fetch related services.
Get-Service –Name "*management*”
Output
Status Name DisplayName ------ ---- ----------- Stopped AppMgmt Application Management Running DellClientManag... Dell Client Management Service Stopped DmEnrollmentSvc Device Management Enrollment Service Stopped dmwappushservice Device Management Wireless Applicat... Stopped EntAppSvc Enterprise App Management Service Running LMS Intel(R) Management and Security Ap... Running RmSvc Radio Management Service Stopped TieringEngineSe... Storage Tiers Management Running Winmgmt Windows Management Instrumentation Stopped WinRM Windows Remote Management (WS-Manag... Stopped WManSvc Windows Management Service Stopped XboxGipSvc Xbox Accessory Management Service
You can also use Where-Object command with a comparison operator to search the above results.
Example
For example, we need to find the service name Spooler.
Get-Service | Where-Object{$_.Name -eq "Spooler"}
Output
Status Name DisplayName ------ ---- ----------- Running Spooler Print Spooler
With the wildcard character (*) but here you need to use comparison operator –like instead of -eq
Get-Service | Where-Object{$_.Name -like "Spoo*"} Status Name DisplayName ------ ---- ----------- Running Spooler Print Spooler
Example
Wildcard character (*) at both ends.
Get-Service | Where-Object{$_.Name -like "*management*"}
Output
Status Name DisplayName ------ ---- ----------- Stopped AppMgmt Application Management Running DellClientManag... Dell Client Management Service Stopped DmEnrollmentSvc Device Management Enrollment Service Stopped dmwappushservice Device Management Wireless Applicat... Stopped EntAppSvc Enterprise App Management Service Running LMS Intel(R) Management and Security Ap... Running RmSvc Radio Management Service Stopped TieringEngineSe... Storage Tiers Management Running Winmgmt Windows Management Instrumentation Stopped WinRM Windows Remote Management (WS-Manag... Stopped WManSvc Windows Management Service Stopped XboxGipSvc Xbox Accessory Management Service
- Related Articles
- How to search for a specific extension using Get-ChildItem in PowerShell?
- How to display specific properties from Get-Service output in PowerShell?
- How to search for files using the wildcard character (*) in PowerShell?
- How to get all properties and methods available for the service in PowerShell?
- How to search in the file using PowerShell?
- How to remove Windows service with PowerShell?
- How to stop a windows service using PowerShell?
- How to start a windows service using PowerShell?
- How to stop the service with the display name in PowerShell?\n
- How to search a MySQL table for a specific string?
- How to stop service with their dependent services in PowerShell?
- How to start windows service with display name in PowerShell?
- How to get service information with the WMI method using PowerShell?
- How to copy files with the specific extension in PowerShell?
- How to search by specific pattern in MySQL?
