- 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 get services based on multiple conditional parameters in PowerShell?
To filter out services with both start-type “Automatic” and Status “stopped” we need to use the -AND comparison operator. Here, services will be displayed only when both conditions are matching.
Command
Get-Service | where{($_.StartType -eq "Automatic") -and ($_.Status -eq "Stopped")} | Select Name, StartType, Status
Output
Name StartType Status ---- --------- ------ gpsvc Automatic Stopped gupdate Automatic Stopped MapsBroker Automatic Stopped
Command
To get services with start-type manual or disabled we will use -OR operator.
Get-Service | where{($_.StartType -eq "Manual") -or ($_.StartType -eq "Disabled")} | Sort-Object Starttype | Select Name, StartType, Status
Output
LxpSvc Manual Stopped lmhosts Manual Running KtmRm Manual Stopped IpxlatCfgSvc Manual Stopped FontCache3.0.0.0 Manual Running KeyIso Manual Running klvssbridge64_20.0 Manual Stopped UevAgentService Disabled Stopped tzautoupdate Disabled Stopped NetTcpPortSharing Disabled Stopped ssh-agent Disabled Stopped shpamsvc Disabled Stopped RemoteRegistry Disabled Stopped AppVClient Disabled Stopped svcdemo Disabled Stopped
- Related Articles
- How to get services based on start-type in PowerShell?
- How to get all the services based on their status in PowerShell?
- How to get services on remote computers with PowerShell?
- How to stop multiple services using PowerShell?
- How to start multiple windows services using PowerShell?
- How to get the services on a local computer with PowerShell?
- How to get supported parameters of the cmdlet in PowerShell?
- How to Apply Conditional Formatting based on VLOOKUP in Excel?
- How can we get sorted output based on multiple columns?
- How to start dependent services in PowerShell?
- How to Apply Conditional Formatting to a Column Based on Another Column in Excel?
- Which attribute parameters are supported in Get-ChildItem in PowerShell?
- What are the parameters supported by Get-ChildItem in PowerShell?
- How to Average Cells Based on Multiple Criteria in Excel?
- How to pass the parameters in the PowerShell function?

Advertisements