Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

powershell v5 using where-object

$
0
0

PS C:\> Get-Service | where status -eq "Running"

Status   Name               DisplayName

------   ----               -----------

Running  AdobeARMservice    Adobe Acrobat Update Service

Running  Appinfo            Application Information

Running  AudioEndpointBu... Windows Audio Endpoint Builder

Running  Audiosrv           Windows Audio

Running  BFE                Base Filtering Engine

Running  BITS               Background Intelligent Transfer Ser...

Running  Bonjour Service    Xamarin Bonjour Service

Running  BrokerInfrastru... Background Tasks Infrastructure Ser...

Running  BthHFSrv           Bluetooth Handsfree Service

Running  bthserv            Bluetooth Support Service

Running  CertPropSvc        Certificate Propagation

PS C:\> Get-Service | where name -like "b*"

Status   Name               DisplayName

------   ----               -----------

Stopped  BDESVC             BitLocker Drive Encryption Service

Running  BFE                Base Filtering Engine

Running  BITS               Background Intelligent Transfer Ser...

Running  Bonjour Service    Xamarin Bonjour Service

Running  BrokerInfrastru... Background Tasks Infrastructure Ser...

Stopped  Browser            Computer Browser

Running  BthHFSrv           Bluetooth Handsfree Service

Running  bthserv            Bluetooth Support Service

PS C:\> Get-Service | where {$PSItem.status -eq "Running" -and $_.name -like "b*"}

Status   Name               DisplayName

------   ----               -----------

Running  BFE                Base Filtering Engine

Running  BITS               Background Intelligent Transfer Ser...

Running  Bonjour Service    Xamarin Bonjour Service

Running  BrokerInfrastru... Background Tasks Infrastructure Ser...

Running  BthHFSrv           Bluetooth Handsfree Service

Running  bthserv            Bluetooth Support Service

Why isn't the following cmdlet not working:-

 

PS C:\> Get-Service | where {status -eq "Running" -and name -like "b*"}

status : The term 'status' is not recognized as the name of a cmdlet, function, script file, or operable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.


Viewing all articles
Browse latest Browse all 6937

Trending Articles